Cocos2d-x 3.2 study notes (8) Action

Source: Internet
Author: User

Action-action. All Genie and human-computer interaction are actions. The actions encapsulated in cocos2dx are rich!

Action has three subclasses.

1. The finitetimeaction class is the base class for all actions that can be completed within a limited time.

2. Follow is an action that "follows" a node.

3. The speed class changes the running speed of an action so that it can last longer (speed> 1) or shorter (speed <1 ). (Speed object cannot be part of an action sequence because it is not an actioninterval object)

Second, the finitetimeaction class is divided into two types of finished tasks with limited time.

1. actioninstant instant action. Unlike actioninterval, instant actions do not last for a long time.

Callback calls a 'callback' function.

Flipx genie horizontal flip.

Flipy genie vertical flip.

Hide hides nodes.

Place the node to a certain position.

Removeself remove a node

Reusegrid repeats the grid action.

Show show nodes.

Stopgrid: Stop the grid action.

Togglevisibility switches the visual attributes of a node.

2. actioninterval is an action that requires continuous operation for a period of time. It has a start time and end time. The End Time is determined by the start time and cycle.

Duration consists of many interesting features, such:

  • Can run normally (default)
  • You can also run it in reverse mode.
  • Can run as the accelerator changes

Accelamplitude amplitude action.

Acceldeccelampl amplitude action.

Actioncamera camera action base class (subclass orbitcamera-the Angle of View rotates around the center of the Screen Based on the spherical coordinate trajectory ).

Actionease easing action base class.

Animate creates a sequence frame animation.

Bezierby besel curve action.

Blink flashes.

Cardinalsplineto base curve path.

Catmullromto is an action that moves the target point according to the catmullrom curve. The Catmull Rom curve path is in radians of 0.5.

Cardinalsplineby base curve path.

Catmullromby is an action that moves the target point according to the Cartesian curve. The radius of the Cartesian curve path is 0.5.

Deccelamplitude amplitude action.

Delaytime delayed action.

Fadeto gradient action. "Reverse" is not supported ".

The fadein gradient action "reverse" is fadeout.

The fadeout gradient action "reverse" is fadein.

The base class of the gridaction grid action.

Jumpby imitates the hop trajectory to move nodes.

Jumpto imitates the moving nodes of the Skip trajectory.

MoveBy modifies the location attribute of the Node object to change the X and Y pixels of the Node object. The coordinates of X and Y are relative to the position of the object. Several moveBy actions can be called at the same time, and the final motion is the combination of these independent motion.

MoveTo modifies the position attribute of the Node object to change the X and Y pixels of the Node object. The coordinates of X and Y are relative to the position of the object. Several moveBy actions can be called at the same time, and the final motion is the combination of these independent motion.

Progressfromto an animation from one percentage to another.

Progressto percentage progress.

Repeat repeats the action multiple times. The number of times is determined by the parameter. Use repeatforever to perform a wireless loop.

Repeatforever wirelessly loops through an action. If you want to loop for a limited number of times, use the repeat action. (This action cannot be used in serial mode because it is not a continuous action)

The reverse action of reversetime. (Use this action with caution. This action cannot be used in a serial action sequence)

Rotateby rotates a node.

Rotateto rotates the node to the specified angle. The direction is determined by the shortest angle.

Scaleto scaling action.

Scaleby scaling.

Sequence performs the action sequentially.

By modifying the skewx and skewy attributes of a Node object, skewto redirects the Node object to a given angle.

Skewby skews node objects by skewx and skewy.

Spawn parallel action.

Targetedaction modifies the target of an action so that the action can run on a specified target when the action is created, rather than the target specified through runaction.

The tintby node changes color.

The tintto node changes color.

 

The method of using actions is also very simple. After creation, the world calls the sprite runaction (Action object) to see the effect.

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.