soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
STranslateAnimation.cpp
1
2#include <souistd.h>
3#include <animation/STranslateAnimation.h>
4SNSBEGIN
5
6void STranslateAnimation::initialize(int width, int height, int parentWidth, int parentHeight, int nScale)
7{
8 mFromXDelta = (float)resolveSize(mFromXValue, width, parentWidth, nScale);
9 mToXDelta = (float)resolveSize(mToXValue, width, parentWidth, nScale);
10 mFromYDelta = (float)resolveSize(mFromYValue, height, parentHeight, nScale);
11 mToYDelta = (float)resolveSize(mToYValue, height, parentHeight, nScale);
12}
13
14void STranslateAnimation::applyTransformation(float interpolatedTime, ITransformation *t)
15{
16 float dx = mFromXDelta;
17 float dy = mFromYDelta;
19 {
20 dx = mFromXDelta + ((mToXDelta - mFromXDelta) * interpolatedTime);
21 }
23 {
24 dy = mFromYDelta + ((mToYDelta - mFromYDelta) * interpolatedTime);
25 }
26 t->GetMatrix()->setTranslate(dx, dy);
27 t->SetTransformationType(TYPE_MATRIX);
28}
29
31{
32 mFromXValue = fromX;
33 mToXValue = toX;
34 mFromYValue = fromY;
35 mToYValue = toY;
36}
37
42
43SNSEND
int resolveSize(const SValueDescription &value, int size, int parentSize, int nScale)
Converts the information in the description of a size to an actual dimension.
float mToXDelta
The ending X delta value.
SValueDescription mToYValue
Description of the ending Y value.
SValueDescription mToXValue
Description of the ending X value.
SValueDescription mFromXValue
Description of the starting X value.
float mToYDelta
The ending Y delta value.
STranslateAnimation()
Default constructor for STranslateAnimation.
void init(const SValueDescription &fromX, const SValueDescription &toX, const SValueDescription &fromY, const SValueDescription &toY)
Constructor to use when building a TranslateAnimation from code.
float mFromYDelta
The starting Y delta value.
SValueDescription mFromYValue
Description of the starting Y value.
void initialize(int width, int height, int parentWidth, int parentHeight, int nScale) OVERRIDE
Initializes the animation with the dimensions of the object and its parent.
float mFromXDelta
The starting X delta value.
void applyTransformation(float interpolatedTime, ITransformation *t) OVERRIDE
Applies the transformation at a specific interpolated time.
Utility class to parse a string description of a size.
Definition SAnimation.h:24