Class cocos.actions.grid3d_actions.Twirl

             object --+                
                      |                
    base_actions.Action --+            
                          |            
base_actions.IntervalAction --+        
                              |        
basegrid_actions.GridBaseAction --+    
                                  |    
      basegrid_actions.Grid3DAction --+
                                      |
                                     Twirl

Simulates a twirl effect modifying the x and y coordinates. The z coordinate is not modified.

Example:

scene.do( Twirl( center=(320,240), twirls=5, amplitude=1, grid=(16,12), duration=10) )

Methods

  init(self, center=(-1,-1), twirls=4, amplitude=1, *args, **kw)
Initialize the Grid Action
  update(self, t)
Gets called on every frame.
Inherited from basegrid_actions.Grid3DAction: get_grid, get_original_vertex, get_vertex, set_vertex Inherited from basegrid_actions.GridBaseAction: __reversed__, start Inherited from base_actions.IntervalAction: done Inherited from base_actions.Action: __add__, __init__, __mul__, __or__, step, stop Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties

Inherited from object: __class__

Instance Variables

  position
position of the center of the Twril.
  twirls
total number of twirls
  amplitude
amplitude of the twirls
  amplitude_rate
amplitude rate.
Inherited from base_actions.Action: target

Method Details

init

init(self, center=(-1,-1), twirls=4, amplitude=1, *args, **kw)
Initialize the Grid Action
Parameters:
twirls : int
Number of twirls (2 * pi) that the action will perform. Default is 4
amplitude : flaot
Twirl amplitude. Default is 1
center : (int,int)
Center of the twirl in x,y coordinates. Default: center of the screen
Overrides:
basegrid_actions.GridBaseAction.init

update

update(self, t)
Gets called on every frame. t is in [0,1] If this action takes 5 seconds to execute, t will be equal to 0 at 0 seconds. t will be 0.5 at 2.5 seconds and t will be 1 at 5sec.
Overrides:
base_actions.IntervalAction.update

Instance Variable Details

position

position of the center of the Twril. Type: (int,int). This value can be modified by other actions, like JumpBy to simulate a jumping Twirl

amplitude_rate

amplitude rate. Default: 1.0. This value is modified by other actions like AccelAmplitude.