cocos.actions.tiledgrid_actions module¶
Implementation of TiledGrid3DAction actions
-
class
FadeOutBLTiles
(*args, **kwargs)¶ Bases:
cocos.actions.tiledgrid_actions.FadeOutTRTiles
Fades out each tile following an Bottom-Left path until all the tiles are faded out.
Example:
scene.do(FadeOutBLTiles(grid=(16,12), duration=5))
-
test_func
(i, j, t)¶
-
-
class
FadeOutDownTiles
(*args, **kwargs)¶ Bases:
cocos.actions.tiledgrid_actions.FadeOutUpTiles
Fades out each tile following an downwards path until all the tiles are faded out.
Example:
scene.do(FadeOutDownTiles(grid=(16,12), duration=5))
-
test_func
(i, j, t)¶
-
-
class
FadeOutTRTiles
(*args, **kwargs)¶ Bases:
cocos.actions.basegrid_actions.TiledGrid3DAction
Fades out each tile following a diagonal Top-Right path until all the tiles are faded out.
Example:
scene.do(FadeOutTRTiles(grid=(16,12), duration=10))
-
test_func
(i, j, t)¶
-
transform_tile
(x, y, t)¶
-
turn_off_tile
(x, y)¶
-
turn_on_tile
(x, y)¶
-
update
(t)¶ Gets called on every frame ‘t’ is the time elapsed normalized to [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. This method must not use self._elapsed, which is not guaranted to be updated.
-
-
class
FadeOutUpTiles
(*args, **kwargs)¶ Bases:
cocos.actions.tiledgrid_actions.FadeOutTRTiles
Fades out each tile following an upwards path until all the tiles are faded out.
Example:
scene.do(FadeOutUpTiles(grid=(16,12), duration=5))
-
test_func
(i, j, t)¶
-
transform_tile
(x, y, t)¶
-
-
class
JumpTiles3D
(*args, **kwargs)¶ Bases:
cocos.actions.basegrid_actions.TiledGrid3DAction
Odd tiles will perform a jump in the z-axis using the sine function, while the even tiles will perform a jump using sine+pi function
Example:
scene.do(JumpTiles3D(jumps=5, amplitude=40, grid=(16,16), duration=10))
-
init
(jumps=4, amplitude=20, *args, **kw)¶ - Parameters
- jumpsint
Number of jumps(2 * pi) that the action will perform. Default is 4
- amplitudeint
Wave amplitude (height). Default is 20
-
update
(t)¶ Gets called on every frame ‘t’ is the time elapsed normalized to [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. This method must not use self._elapsed, which is not guaranted to be updated.
-
-
class
ShakyTiles3D
(*args, **kwargs)¶ Bases:
cocos.actions.basegrid_actions.TiledGrid3DAction
Simulates a shaky floor composed of tiles
Example:
scene.do(ShakyTiles3D(randrange=6, grid=(4,4), duration=10))
-
init
(randrange=6, *args, **kw)¶ - Parameters
- randrangeint
Number that will be used in random.randrange(-randrange, randrange) to do the effect
-
update
(t)¶ Gets called on every frame ‘t’ is the time elapsed normalized to [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. This method must not use self._elapsed, which is not guaranted to be updated.
-
-
class
ShatteredTiles3D
(*args, **kwargs)¶ Bases:
cocos.actions.basegrid_actions.TiledGrid3DAction
ShatterTiles shatters the tiles according to a random value. It is similar to shakes (see ShakyTiles3D) the tiles just one frame, and then continue with that state for duration time.
Example:
scene.do(ShatteredTiles3D(randrange=12))
-
init
(randrange=6, *args, **kw)¶ - Parameters
- randrangeint
Number that will be used in random.randrange(-randrange, randrange) to do the effect
-
update
(t)¶ Gets called on every frame ‘t’ is the time elapsed normalized to [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. This method must not use self._elapsed, which is not guaranted to be updated.
-
-
class
ShuffleTiles
(*args, **kwargs)¶ Bases:
cocos.actions.basegrid_actions.TiledGrid3DAction
ShuffleTiles moves the tiles randomly across the screen. To put them back use: Reverse(ShuffleTiles()) with the same seed parameter.
Example:
scene.do(ShuffleTiles(grid=(4,4), seed=1, duration=10))
-
init
(seed=- 1, *args, **kw)¶ - Parameters
- seedfloat
Seed for the random in the shuffle.
-
place_tile
(i, j)¶
-
start
()¶ External code sets self.target and then calls this method. Perform here any extra initialization needed.
-
update
(t)¶ Gets called on every frame ‘t’ is the time elapsed normalized to [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. This method must not use self._elapsed, which is not guaranted to be updated.
-
-
class
SplitCols
(*args, **kwargs)¶ Bases:
cocos.actions.basegrid_actions.TiledGrid3DAction
Split the screen in a number of columns, and move these columns away from the screen.
The odds columns are moved to the upwards, while the even columns are moved to the downwards.
Example:
scene.do(SplitCols(cols=3, duration=2))
-
init
(cols=9, grid=- 1, - 1, *args, **kw)¶ - Parameters
- colsint
Number of columns that will have the effect. Default: 9
-
update
(t)¶ Gets called on every frame ‘t’ is the time elapsed normalized to [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. This method must not use self._elapsed, which is not guaranted to be updated.
-
-
class
SplitRows
(*args, **kwargs)¶ Bases:
cocos.actions.basegrid_actions.TiledGrid3DAction
Split the screen in a number of rows, and move these rows away from the screen.
The odds rows are moved to the left, while the even rows are moved to the right.
Example:
scene.do(SplitRows(rows=3, duration=2))
-
init
(rows=9, grid=- 1, - 1, *args, **kw)¶ - Parameters
- rowsint
Number of rows that will have the effect. Default: 9
-
update
(t)¶ Gets called on every frame ‘t’ is the time elapsed normalized to [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. This method must not use self._elapsed, which is not guaranted to be updated.
-
-
class
TurnOffTiles
(*args, **kwargs)¶ Bases:
cocos.actions.basegrid_actions.TiledGrid3DAction
TurnOffTiles turns off each in random order
Example:
scene.do(TurnOffTiles(grid=(16,12), seed=1, duration=10))
-
get_tile_pos
(idx)¶
-
init
(seed=- 1, *args, **kw)¶ Initialize the Grid Action
- Parameters
- grid(int,int)
Number of horizontal and vertical quads in the grid
- durationint
Number of seconds that the action will last
-
start
()¶ External code sets self.target and then calls this method. Perform here any extra initialization needed.
-
turn_off_tile
(t)¶
-
turn_on_tile
(t)¶
-
update
(t)¶ Gets called on every frame ‘t’ is the time elapsed normalized to [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. This method must not use self._elapsed, which is not guaranted to be updated.
-
-
class
WavesTiles3D
(*args, **kwargs)¶ Bases:
cocos.actions.basegrid_actions.TiledGrid3DAction
Simulates waves using the math.sin() function in the z-axis of each tile
Example:
scene.do(WavesTiles3D(waves=5, amplitude=120, grid=(16,16), duration=10))
-
init
(waves=4, amplitude=120, *args, **kw)¶ - Parameters
- wavesint
Number of waves (2 * pi) that the action will perform. Default is 4
- amplitudeint
Wave amplitude (height). Default is 20
-
update
(t)¶ Gets called on every frame ‘t’ is the time elapsed normalized to [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. This method must not use self._elapsed, which is not guaranted to be updated.
-