cocos2d DrawNode图形渐变

//点变线

void HelloWorld::dotChangeToLine(int curMenutag)

{
log("dotChangeToLine");

//是一条窄窄的矩形线
DrawNode* drawmove = static_cast<DrawNode*>(PointMoveBox->getChildByTag(SolidLineTag)); //two words len subline


drawhome->setVisible(false);


this->schedule(schedule_selector(HelloWorld::updateDotToTVLine),DOT_UPDATE_TIME);

}


void HelloWorld::updateDotToTVLine(float dt)
{
log("updateDotToTVLine 1234");

DrawNode* drawmove = static_cast<DrawNode*>(PointMoveBox->getChildByTag(SolidLineTag)); //two words len subline

//将原图形清掉
drawmove->clear();

//左边办越来越向左去
m_rectLeft = m_rectLeft - DOT_CHANGE_SPEED;

//右边界越来越向右去
m_rectRight = m_rectRight + DOT_CHANGE_SPEED;


Vec2 oriP = Vec2(m_rectLeft,POINT_MOVE_Five - POINT_MOVE_Three); // 80 - POINT_MOVE_FIVE
Vec2 endP = Vec2(m_rectRight,POINT_MOVE_Five + POINT_MOVE_Three);


Color4F lineColor = Color4F(Color3B(60,190,240)); //line color
drawmove->drawSolidRect(oriP,endP,lineColor); //绘制变大的矩形
int lineWidth = m_rectRight - m_rectLeft;

//如果宽度达到了标准,就停止渐变 if (lineWidth >= 2 * POINT_MOVE_Vec2x_Increment_Sixty) //when line width add to orign width,stop become width { this->unschedule(schedule_selector(HelloWorld::updateDotToTVLine)); //Node::unschedule("updateLineToDot"); log("unschedule updateDotToTVLine"); } }

相关文章

操作步骤 1、创建cocos2d-x工程 2、新建 Scene1.cpp Scene1.h Scene1.h代码 #ifndef __SCENE1_H__#defi...
开发环境:OS(WINDOWS 8.1 X64 企业版) cocos2d-x 2.2.1 vs2010 想给vs安装上cocos的模版,执行Install...
把创建项目做成一个批处理,当创建项目时可以省时省力很多。 操作步骤 1、在 E:cocos2d-x-2.2.1toolspr...
https://www.cnblogs.com/JiaoQing/p/3906780.html 四个响应函数 1 EventListenerPhysicsContact* evC...
转载于 http://www.cnblogs.com/kenkofox/p/3926797.html 熟悉js的dom事件或者flash事件的,基本都能立...
ScrollView(滚动容器)加载大量item时会导致游戏界面的卡顿,严重时整个界面会出现卡死的情况。最近项...