Cocos2dx Animation 1, cocos2dx Animation

Source: Internet
Author: User
Tags addchild

Cocos2dx Animation 1, cocos2dx Animation

1. The runAction method of the genie

1 spt = Sprite: create ("pean.jpg"); 2 this-> addChild (spt); 3 4 MenuItemFont * item = MenuItemFont: create ("START ", [&] (Ref * spen) {5 ToggleVisibility * visi = ToggleVisibility: create (); 6 spt-> runAction (visi); 7 }); 8 Menu * menu = Menu: create (item, NULL); 9 menu-> setPosition (100,500); 10 this-> addChild (menu );

2. FadeTo Method

1 FadeTo *fade = FadeTo::create(2.0, 0);2 spt->runAction(fade);

3. MoveTo Method

1 MoveTo *move = MoveTo::create(2, ccp(500,500));2 spt->runAction(move);

4. MoveBy method (x/y axis offset)

1 MoveBy *move = MoveBy::create(2.0, Vec2(100, 100));2 spt->runAction(move);

5. JumpBy

First parameter: Total skip time

Second parameter: the offset position after the jump

Third parameter: jump height

Fourth parameter: Number of hops

1 JumpBy *by = JumpBy::create(2.0, Vec2(200,0), 300, 1);2 spt->runAction(by);

6. CardinalSplineBy (move by track)

It seems that CardinalSplineBy is the same as CardinalSplineTo, and the point is not the offset.

PointArray *pa = PointArray::create(5);pa->addControlPoint(Vec2(200,0));pa->addControlPoint(Vec2(200,200));pa->addControlPoint(Vec2(400,200));pa->addControlPoint(Vec2(400,0));CardinalSplineBy *sb = CardinalSplineBy::create(5.0, pa, 1);spt->runAction(sb);

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.