cocos.actions.grid3d_actions module — cocos v0.6.10 documentation

# cocos.actions.grid3d_actions module

Implementation of Grid3DAction actions

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)

    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

  `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 `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)

    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

  `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 `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 )

      radiusint

        Radius of the lens.

      lens_effectfloat

        How strong is the lens effect. Default: 0.7. 0 is no effect at all, 1 is a very strong lens 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 `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:
      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.

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)

      radiusint

        Radius of the ripple. Default: 240

      wavesint

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

      amplitudeint

        Wave amplitude (height). Default is 60

  `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 `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:
      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 `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:
      twirlsint

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

      amplitudeflaot

        Twirl amplitude. Default is 1

      center(int,int)

        Center of the twirl in x,y coordinates. Default: center of the screen

  `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 `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:
      wavesint

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

      amplitudeint

        Wave amplitude (height). Default is 20

      hsinbool

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

      vsinbool

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

  `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 `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:
      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.