精灵沿着正方形路线运动暂停2秒后然后再将自己放大4倍

精灵沿着正方形路线运动暂停2秒后然后再将自己放大4倍

 

 1     //////////////     CardinalSpline  样条曲线   ///////////////
 2     
 3     Sprite* sprite = Sprite::create("button.png");
 4     //sprite->setPosition(Vec2(visibleSize.width * 0.2, visibleSize.height * 0.5));
 5     this->addChild(sprite);
 6 
 7     // 专门存放点的数组
 8     PointArray *arr = PointArray::create(10);
 9     arr->addControlPoint(Vec2(visibleSize.width * 0.2, visibleSize.height * 0.2));
10     arr->addControlPoint(Vec2(visibleSize.width * 0.2, visibleSize.height * 0.8));
11     arr->addControlPoint(Vec2(visibleSize.width * 0.8, visibleSize.height * 0.8));
12     arr->addControlPoint(Vec2(visibleSize.width * 0.8, visibleSize.height * 0.2));
13     arr->addControlPoint(Vec2(visibleSize.width * 0.2, visibleSize.height * 0.2));
14 
15     // 参数(时间,点数,(1代表是直线, >1或<1 都是曲线 ))
16     //ActionInterval * spline = CardinalSplineTo::create(5.0f, arr, 1);
17     //ActionInterval * spline = CardinalSplineTo::create(5.0f, arr, 0.3);
18     //ActionInterval * spline = CardinalSplineTo::create(5.0f, arr, 5);
19 
20     //ActionInterval * spline = CardinalSplineBy::create(5.0f, arr, 1);
21     //ActionInterval * spline = CardinalSplineBy::create(5.0f, arr, 0.3);
22     ActionInterval * spline = CardinalSplineBy::create(5.0f, arr, 5);
23     
24     ActionInterval * scale = ScaleTo::create(1.0f, 4.0f);
25 
26     ActionInterval* seq = Sequence::create(spline, DelayTime::create(2.0f), scale, nullptr);
27 
28     sprite->runAction(seq);
29 
30     //////////////     CardinalSpline  样条曲线   ///////////////

 

posted @ 2015-06-05 20:17  silent-bobo  阅读(215)  评论(0编辑  收藏  举报