Module cocos.actions.interval_actions

Interval Action

Interval Actions

An interval action is an action that takes place within a certain period of time. It has an start time, and a finish time. The finish time is the parameter duration plus the start time.

These IntervalAction have some interesting properties, like:

For example, you can simulate a Ping Pong effect running the action normally and then running it again in Reverse mode.

Example:

ping_pong_action = action + Reverse( action )

Available IntervalActions

Modifier actions

Examples:

move = MoveBy( (200,0), duration=5 )  # Moves 200 pixels to the right in 5 seconds.

move = MoveTo( (320,240), duration=5) # Moves to the pixel (320,240) in 5 seconds

jump = JumpBy( (320,0), 100, 5, duration=5) # Jumps to the right 320 pixels
                                            # doing 5 jumps of 100 pixels
                                            # of height in 5 seconds

accel_move = Accelerate(move)               # accelerates action move

Classes

  Lerp
Interpolate between values for some specified attribute
  RotateBy
Rotates a CocosNode object clockwise a number of degrees by modiying it's rotation attribute.
  Rotate
Rotates a CocosNode object clockwise a number of degrees by modiying it's rotation attribute.
  RotateTo
Rotates a CocosNode object to a certain angle by modifying it's rotation attribute.
  Speed
Changes the speed of an action, making it take longer (speed>1) or less (speed<1)
  Accelerate
Changes the acceleration of an action
  AccelDeccel
Makes an action change the travel speed but retain near normal speed at the beginning and ending.
  MoveTo
Moves a CocosNode object to the position x,y.
  MoveBy
Moves a CocosNode object x,y pixels by modifying it's position attribute.
  FadeOut
Fades out a CocosNode object by modifying it's opacity attribute.
  FadeTo
Fades a CocosNode object to a specific alpha value by modifying it's opacity attribute.
  FadeIn
Fades in a CocosNode object by modifying it's opacity attribute.
  ScaleTo
Scales a CocosNode object to a zoom factor by modifying it's scale attribute.
  ScaleBy
Scales a CocosNode object a zoom factor by modifying it's scale attribute.
  Blink
Blinks a CocosNode object by modifying it's visible attribute
  Bezier
Moves a CocosNode object through a bezier path by modifying it's position attribute.
  Jump
Moves a CocosNode object simulating a jump movement by modifying it's position attribute.
  JumpBy
Moves a CocosNode object simulating a jump movement by modifying it's position attribute.
  JumpTo
Moves a CocosNode object to a position simulating a jump movement by modifying it's position attribute.
  Delay
Delays the action a certain amount of seconds
  RandomDelay
Delays the actions between min and max seconds