cocos2d DrawNode图形渐变

cocos2d DrawNode图形渐变,第1张

概述//点变线 void HelloWorld::dotChangeToLine(int curMenutag) { log("dotChangeToLine"); //是一条窄窄的矩形线 DrawNode* drawmove = static_cast<DrawNode*>(PointMoveBox->getChildByTag(SolidLineTag));   //two words len s

//点变线

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"); } }

总结

以上是内存溢出为你收集整理的cocos2d DrawNode图形渐变全部内容,希望文章能够帮你解决cocos2d DrawNode图形渐变所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1080185.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-27
下一篇2022-05-27

发表评论

登录后才能评论

评论列表(0条)

    保存