滾動公告並實現文字淡入淡出

2021-09-16 19:19:32 字數 1411 閱讀 2401

#pragma once

#include "cocos2d.h"

#include "2d/ccclippingnode.h"

using_ns_cc;

class pannelnews :public node

;

#include "pannelnews.h"

#include "defineconfig.h"

#include "../../tools/stringtools.h"

#define start_w 1058

#define end_w -10

#define fade_length 300.f

pannelnews::pannelnews()

pannelnews::~pannelnews()

bool pannelnews::init()

; //標記顯示的矩形區域

_shap->drawpolygon(point, 4, color4f(255, 255, 255, 255), 2, color4f(255, 255, 255, 255));

//剪下用於顯示的矩形區域,引數對應:用於標識區域的point(vec2)陣列指標,陣列長度,填充顏色,邊框寬度,邊框顏色

_cliper = clippingnode::create();

_cliper->setstencil(_shap);

_cliper->setanchorpoint(point(0.5, 0.5));

_newsbg->addchild(_cliper);

_news = label::createwithttf("", font_path_hkyt, 30);

_news->setcolor(color3b(255, 255, 255));

_news->enableoutline(color4b(216, 129, 26, 255), 1);

_cliper->addchild(_news);

layout();

return true;

}void pannelnews::layout()

void pannelnews::scrolltext(float)

else if (letterx > start_w - fade_length)

else

} }

if (_news->getpositionx() < end_w - _news->getcontentsize().width && updatetext()) }

bool pannelnews::updatetext()

this->setvisible(false);

return false;

}

jquery實現彈窗淡入淡出

1.要展示彈窗的html中增加彈窗內容如下 id executecaseconfig style display none class executecase mask class title 案例執行配置onclick closeexecutecasepopup xspan h4 div clas...

視窗淡入淡出效果的實現

1.簡介 函式 setlayeredwindowattributes header declared in winuser.h,include windows.h import library user32.lib minimum operating systems windows 2000 所以在...

視窗淡入淡出效果的實現

1.簡介 函式 setlayeredwindowattributes header declared in winuser.h,include windows.h import library user32.lib minimum operating systems windows 2000 所以在...