soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SAlphaAnimation.cpp
1
2#include <souistd.h>
3#include <animation/SAlphaAnimation.h>
4
5SNSBEGIN
6
8 : mFromAlpha(0.f)
9 , mToAlpha(0.0f)
10{
11}
12
13void SAlphaAnimation::init(float fromAlpha, float toAlpha)
14{
15 mFromAlpha = fromAlpha;
16 mToAlpha = toAlpha;
17}
18
20{
21 return true;
22}
23
24void SAlphaAnimation::applyTransformation(float interpolatedTime, ITransformation *t)
25{
26 float alpha = mFromAlpha;
27 t->SetAlpha((BYTE)((alpha + ((mToAlpha - alpha) * interpolatedTime)) * 255));
28}
29
30void SAlphaAnimation::copy(const IAnimation *src)
31{
32 const SAlphaAnimation *src2 = sobj_cast<const SAlphaAnimation>(src);
33 if (!src2)
34 return;
36 mFromAlpha = src2->mFromAlpha;
37 mToAlpha = src2->mToAlpha;
38}
39
40SNSEND
void copy(const IAnimation *src)
Copies the properties of another animation to this animation.
void init(float fromAlpha=0.0f, float toAlpha=0.0f)
Initializes the alpha animation with specified start and end alpha values.
BOOL hasAlpha()
Checks if the animation affects the alpha property.
SAlphaAnimation()
Default constructor.
void applyTransformation(float interpolatedTime, ITransformation *t)
Changes the alpha property of the supplied STransformation.
void copy(const IAnimation *src) OVERRIDE
Copies the properties of another animation to this animation.