Loading [MathJax]/extensions/MathZoom.js

⚠️ This documentation corresponds to the latest development branch of axmol. It might diverge from the official releases.

Axmol Engine 3.0.0-dff292a
Loading...
Searching...
No Matches
ActionInterval Class Reference

An interval action is an action that takes place within a certain period of time. More...

#include <ActionInterval.h>

Inherited by AccelAmplitude, AccelDeccelAmplitude, ActionFloat, ActionTween, Animate, Animate3D, BezierBy, Blink, CardinalSplineTo, DeccelAmplitude, DelayTime, FadeTo, GridAction, JumpBy, MoveBy, ProgressFromTo, ProgressTo, Repeat, RepeatForever, ResizeBy, ResizeTo, ReverseTime, RotateBy, RotateTo, ScaleTo, Sequence, SkewTo, Spawn, TargetedAction, TintBy, and TintTo.

Public Member Functions

float getElapsed ()
 How many seconds had elapsed since the actions started to run.
void setAmplitudeRate (float amp)
 Sets the amplitude rate, extension in GridAction.
float getAmplitudeRate ()
 Gets the amplitude rate, extension in GridAction.
void step (float dt) override
bool initWithDuration (float d)
 initializes the action

Detailed Description

An interval action is an action that takes place within a certain period of time.

It has an start time, and a finish time. The finish time is the parameter duration plus the start time.

These ActionInterval actions have some interesting properties, like:

  • They can run normally (default)
  • They can run reversed with the reverse method
  • They can run with the time altered with the Accelerate, AccelDeccel and Speed actions.

For example, you can simulate a Ping Pong effect running the action normally and then running it again in Reverse mode.

Example:

auto action = MoveBy::create(1.0f, Vec2::ONE);
auto pingPongAction = Sequence::create(action, action->reverse(), nullptr);
static MoveBy * create(float duration, const Vec2 &deltaPosition)
Creates the action.
static Sequence * create(FiniteTimeAction *action1,...) AX_REQUIRES_NULL_TERMINATION
Helper constructor to create an array of sequenceable actions.
static const Vec2 ONE
equals to Vec2(1,1)
Definition Vec2.h:788

Member Function Documentation

◆ getElapsed()

float getElapsed ( )
inline

How many seconds had elapsed since the actions started to run.

Returns
The seconds had elapsed since the actions started to run.

◆ setAmplitudeRate()

void setAmplitudeRate ( float amp)

Sets the amplitude rate, extension in GridAction.

Parameters
ampThe amplitude rate.

◆ getAmplitudeRate()

float getAmplitudeRate ( )

Gets the amplitude rate, extension in GridAction.

Returns
The amplitude rate.

◆ step()

void step ( float dt)
override
Parameters
dtin seconds

The documentation for this class was generated from the following file:
  • ActionInterval.h