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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

天马流星2719

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值