Loading [MathJax]/jax/input/TeX/config.js

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

 
Axmol Engine 2.4.0-ce063c5
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Modules Pages
Loading...
Searching...
No Matches
ActionTween Class Reference

ActionTween. More...

#include <ActionTween.h>

Inherits ActionInterval.

Public Member Functions

bool initWithDuration (float duration, std::string_view key, float from, float to)
 Initializes the action with the property name (key), and the from and to parameters.
 
- Public Member Functions inherited from ActionInterval
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.
 
virtual void step (float dt) override
 
bool initWithDuration (float d)
 initializes the action
 

Static Public Member Functions

static ActionTweencreate (float duration, std::string_view key, float from, float to)
 Create and initializes the action with the property name (key), and the from and to parameters.
 

Detailed Description

ActionTween.

ActionTween is an action that lets you update any property of an object. For example, if you want to modify the "width" property of a target from 200 to 300 in 2 seconds, then:

auto modifyWidth = ActionTween::create(2, "width", 200, 300);
target->runAction(modifyWidth);
static ActionTween * create(float duration, std::string_view key, float from, float to)
Create and initializes the action with the property name (key), and the from and to parameters.

Another example: ScaleTo action could be rewritten using PropertyAction:

// scaleA and scaleB are equivalents
auto scaleA = ScaleTo::create(2, 3); // (duration, to)
auto scaleB = ActionTween::create(2, "scale", 1, 3); // (duration, key, from, to)
static ScaleTo * create(float duration, float s)
Creates the action with the same scale factor for X and Y.
Since
v0.99.2

Member Function Documentation

◆ create()

static ActionTween * create ( float duration,
std::string_view key,
float from,
float to )
static

Create and initializes the action with the property name (key), and the from and to parameters.

Parameters
durationThe duration of the ActionTween. It's a value in seconds.
keyThe key of property which should be updated.
fromThe value of the specified property when the action begin.
toThe value of the specified property when the action end.
Returns
If the creation success, return a pointer of ActionTween; otherwise, return nil.

◆ initWithDuration()

bool initWithDuration ( float duration,
std::string_view key,
float from,
float to )

Initializes the action with the property name (key), and the from and to parameters.

Parameters
durationThe duration of the ActionTween. It's a value in seconds.
keyThe key of property which should be updated.
fromThe value of the specified property when the action begin.
toThe value of the specified property when the action end.
Returns
If the initialization success, return true; otherwise, return false.

The documentation for this class was generated from the following file: