Class cocos.actions.grid3d_actions.Lens3D

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

Lens simulates a Lens / Magnifying glass effect. It modifies the z-coordinate while the x and y remains unmodified.

Example:

scene.do( Lens3D(center=(320,240), radius=150, grid=(16,16), duration=10) )

Methods

  init(self, center=(-1,-1), radius=160, lens_effect=0.7, *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 len.
  radius
radius of the lens.
  lens_effect
lens effect factor.
Inherited from base_actions.Action: target

Method Details

init

init(self, center=(-1,-1), radius=160, lens_effect=0.7, *args, **kw)
Initialize the Grid Action
Parameters:
center : (int,int)
Center of the lens. Default: (win_size_width /2, win_size_height /2 )
radius : int
Radius of the lens.
lens_effect : float
How strong is the lens effect. Default: 0.7. 0 is no effect at all, 1 is a very strong lens effect.
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 len. Type: (int,int). This value can be modified by other actions, like JumpBy to simulate a jumping lens

radius

radius of the lens. Type: float

lens_effect

lens effect factor. Type: float