cocos.actions.grid3d_actions module

Implementation of Grid3DAction actions

class Waves3D(*args, **kwargs)

Bases: cocos.actions.basegrid_actions.Grid3DAction

Simulates waves using the math.sin() function in the z-axis The x and y coordinates remains unmodified.

Example:

scene.do(Waves3D(waves=5, amplitude=40, grid=(16,16), duration=10))
init(waves=4, amplitude=20, *args, **kw)
Parameters:
waves
: int

Number of waves (2 * pi) that the action will perform. Default is 4

amplitude
: int

Wave amplitude (height). Default is 20

update(t)
class FlipX3D(*args, **kwargs)

Bases: cocos.actions.basegrid_actions.Grid3DAction

FlipX3D flips the screen using the Y-axis as a pivot.

init(grid=(1, 1), *args, **kw)
update(t)
class FlipY3D(*args, **kwargs)

Bases: cocos.actions.basegrid_actions.Grid3DAction

FlipY3D flips the screen using the X-axis as a pivot.

init(grid=(1, 1), *args, **kw)
update(t)
class Lens3D(*args, **kwargs)

Bases: cocos.actions.basegrid_actions.Grid3DAction

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))
init(center=(-1, -1), radius=160, lens_effect=0.7, *args, **kw)
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.

update(t)
class Shaky3D(*args, **kwargs)

Bases: cocos.actions.basegrid_actions.Grid3DAction

Shaky simulates an earthquake by modifying randomly the x, y and z coordinates of each vertex.

Example:

scene.do(Shaky3D(randrange=6, grid=(4,4), duration=10))
init(randrange=6, *args, **kw)
Parameters:
randrange
: int

Number that will be used in random.randrange(-randrange, randrange) to do the effect

update(t)
class Ripple3D(*args, **kwargs)

Bases: cocos.actions.basegrid_actions.Grid3DAction

Simulates a ripple (radial wave) effect. The amplitude of the wave will decrease when it goes away from the center of the ripple. It modifies the z-coordinate while the x and y remains unmodified.

Example:

scene.do(Ripple3D(center=(320,240), radius=240, waves=15, amplitude=60, duration=20, grid=(32,24)))
init(center=(-1, -1), radius=240, waves=15, amplitude=60, *args, **kw)
Parameters:
center
: (int,int)

Center of the ripple. Default: (win_size_width /2, win_size_height /2)

radius
: int

Radius of the ripple. Default: 240

waves
: int

Number of waves (2 * pi) that the action will perform. Default: 15

amplitude
: int

Wave amplitude (height). Default is 60

update(t)
class Liquid(*args, **kwargs)

Bases: cocos.actions.basegrid_actions.Grid3DAction

Simulates a liquid effect using the math.sin() function modifying the x and y coordinates. The z coordinate remains unmodified.

Example:

scene.do(Liquid(waves=5, amplitude=40, grid=(16,16), duration=10))
init(waves=4, amplitude=20, *args, **kw)
Parameters:
waves
: int

Number of waves (2 * pi) that the action will perform. Default is 4

amplitude
: int

Wave amplitude (height). Default is 20

update(t)
class Waves(*args, **kwargs)

Bases: cocos.actions.basegrid_actions.Grid3DAction

Simulates waves using the math.sin() function both in the vertical and horizontal axis. The z coordinate is not modified.

Example:

scene.do(Waves(waves=4, amplitude=20, hsin=False, vsin=True, grid=(16,16), duration=10))
init(waves=4, amplitude=20, hsin=True, vsin=True, *args, **kw)

Initializes the Waves actions

Parameters:
waves
: int

Number of waves (2 * pi) that the action will perform. Default is 4

amplitude
: int

Wave amplitude (height). Default is 20

hsin
: bool

whether or not in will perform horizontal waves. Default is True

vsin
: bool

whether or not in will perform vertical waves. Default is True

update(t)
class Twirl(*args, **kwargs)

Bases: cocos.actions.basegrid_actions.Grid3DAction

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))
init(center=(-1, -1), twirls=4, amplitude=1, *args, **kw)
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

update(t)