soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SAnimationSet Class Reference

Represents a group of Animations that should be played together. More...

#include <SAnimationSet.h>

Inheritance diagram for SAnimationSet:
SAnimation TObjRefImpl< SObjectImpl< IAnimation > > SObjectImpl< IAnimation >

Public Member Functions

 SAnimationSet (bool shareInterpolator=true)
 Constructor to use when building an AnimationSet from code.
 
void addAnimation (IAnimation *a)
 Add a child animation to this animation set. The transforms of the child animations are applied in the order that they were added.
 
bool hasAlpha ()
 Checks if any child animation affects the alpha property.
 
void setFillAfter (BOOL bFill) OVERRIDE
 Sets whether the animation transformation should be applied after the animation ends.
 
void setFillBefore (BOOL bFill) OVERRIDE
 Sets whether the animation transformation should be applied before the animation starts.
 
void setDuration (long durationMillis) OVERRIDE
 Sets the duration of every child animation.
 
long getDuration () SCONST OVERRIDE
 Gets the duration of the AnimationSet. The duration of an AnimationSet is defined to be the duration of the longest child animation.
 
BOOL getTransformation (uint64_t currentTime, ITransformation *outTransformation) OVERRIDE
 Gets the transformation at a specific time. The transformation of an animation set is the concatenation of all of its component animations.
 
void scaleCurrentDuration (float scale) OVERRIDE
 Scales the current duration of the animation.
 
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.
 
void copy (const IAnimation *src) OVERRIDE
 Copies the properties of another animation to this animation.
 
void pause () OVERRIDE
 Pauses the animation.
 
void resume () OVERRIDE
 Resumes the animation.
 
- Public Member Functions inherited from SAnimation
 SAnimation ()
 Default constructor for SAnimation.
 
 ~SAnimation ()
 Destructor for SAnimation.
 
IAnimation * clone () SCONST OVERRIDE
 Creates a new animation with a duration of 0ms, the default interpolator, with fillBefore set to true and fillAfter set to false.
 
void copy (const IAnimation *src) OVERRIDE
 Copies the properties of another animation to this animation.
 
void reset () OVERRIDE
 Resets the animation to its initial state.
 
void cancel () OVERRIDE
 Cancels the animation.
 
void setInterpolator (IInterpolator *i) OVERRIDE
 Sets the interpolator used by the animation to smooth the movement.
 
void setDuration (long durationMillis) OVERRIDE
 Sets the duration of one animation cycle in milliseconds.
 
void scaleCurrentDuration (float scale) OVERRIDE
 Scales the current duration of the animation.
 
void setFillBefore (BOOL bFill) OVERRIDE
 Sets whether the animation transformation should be applied before the animation starts.
 
void setFillAfter (BOOL bFill) OVERRIDE
 Sets whether the animation transformation should be applied after the animation ends.
 
BOOL getFillBefore () SCONST OVERRIDE
 Gets whether the animation transformation should be applied before the animation starts.
 
BOOL getFillAfter () SCONST OVERRIDE
 Gets whether the animation transformation should be applied after the animation ends.
 
void setStartOffset (long offset) OVERRIDE
 Sets the delay in milliseconds after which the animation must start.
 
BOOL isFillEnabled () SCONST OVERRIDE
 Checks whether fillBefore should be taken into account.
 
void setFillEnabled (BOOL fillEnabled) OVERRIDE
 Sets whether fillBefore should be taken into account.
 
void setStartTime (int64_t startTimeMillis) OVERRIDE
 Sets the start time of the animation.
 
void start () OVERRIDE
 Starts the animation.
 
void startNow () OVERRIDE
 Starts the animation immediately.
 
void setRepeatMode (RepeatMode repeatMode) OVERRIDE
 Sets the repeat mode of the animation.
 
void setRepeatCount (int repeatCount) OVERRIDE
 Sets the number of times the animation must repeat.
 
void setZAdjustment (ZAdjustment zAdjustment) OVERRIDE
 Sets the desired Z order mode during animation.
 
IInterpolator * getInterpolator () SCONST OVERRIDE
 Gets the interpolator used by the animation.
 
int64_t getStartTime () SCONST OVERRIDE
 Gets the start time of the animation.
 
long getDuration () SCONST OVERRIDE
 Gets the duration of one animation cycle.
 
long getStartOffset () SCONST OVERRIDE
 Gets the delay in milliseconds after which the animation must start.
 
RepeatMode getRepeatMode () SCONST OVERRIDE
 Gets the repeat mode of the animation.
 
int getRepeatCount () SCONST OVERRIDE
 Gets the number of times the animation must repeat.
 
ZAdjustment getZAdjustment () SCONST OVERRIDE
 Gets the desired Z order mode during animation.
 
void setAnimationListener (IAnimationListener *listener) OVERRIDE
 Sets the animation listener to be notified when the animation starts, ends, or repeats.
 
long computeDurationHint () SCONST OVERRIDE
 Computes the duration hint for the animation.
 
BOOL getTransformation2 (uint64_t currentTime, ITransformation *outTransformation, float scale) OVERRIDE
 Gets the transformation at a specific time.
 
BOOL getTransformation (uint64_t currentTime, ITransformation *outTransformation) OVERRIDE
 Gets the transformation at a specific time.
 
BOOL hasStarted () SCONST OVERRIDE
 Checks whether the animation has started.
 
BOOL hasEnded () SCONST OVERRIDE
 Checks whether the animation has ended.
 
void applyTransformation (float interpolatedTime, ITransformation *t) OVERRIDE
 Applies the transformation at a specific interpolated time.
 
BOOL hasAlpha () SCONST OVERRIDE
 Checks whether the animation affects the alpha property.
 
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.
 
void setUserData (ULONG_PTR data) OVERRIDE
 Sets user data associated with the animation.
 
ULONG_PTR getUserData () SCONST OVERRIDE
 Gets user data associated with the animation.
 
void pause () OVERRIDE
 Pauses the animation.
 
void resume () OVERRIDE
 Resumes the animation.
 
- Public Member Functions inherited from TObjRefImpl< SObjectImpl< IAnimation > >
 TObjRefImpl ()
 Constructor that initializes the reference count to 1.
 
virtual ~TObjRefImpl ()
 Virtual destructor.
 
long AddRef () override
 Increments the reference count.
 
long Release () override
 Decrements the reference count and deletes the object if the count reaches zero.
 
void OnFinalRelease () override
 Deletes the object.
 
- Public Member Functions inherited from SObjectImpl< IAnimation >
 SObjectImpl ()
 Constructor.
 
BOOL InitFromXml (IXmlNode *pXmlNode) OVERRIDE
 Initializes the object from an XML node.
 
LPCWSTR GetName () SCONST OVERRIDE
 Retrieves the object's name.
 
LPCSTR GetNameA () SCONST OVERRIDE
 Retrieves the object's name in ANSI format.
 
void SetName (LPCWSTR pszName) OVERRIDE
 Sets the object's name.
 
int GetID () SCONST OVERRIDE
 Retrieves the object's ID.
 
void SetID (int nID) OVERRIDE
 Sets the object's ID.
 
HRESULT AfterAttribute (LPCWSTR strAttribName, LPCWSTR strValue, BOOL bLoading, HRESULT hr) OVERRIDE
 Handles attribute processing after setting an attribute.
 
HRESULT SetAttributeA (LPCSTR pszAttr, LPCSTR pszValue, BOOL bLoading) OVERRIDE
 Sets an attribute using ANSI strings.
 
HRESULT SetAttribute (LPCWSTR pszAttr, LPCWSTR pszValue, BOOL bLoading) OVERRIDE
 Sets an attribute using wide strings.
 
virtual HRESULT SetAttribute (const SStringW &strAttr, const SStringW &strValue, BOOL bLoading)
 Sets an attribute using wide strings.
 
HRESULT ISetAttribute (const IStringW *strAttr, const IStringW *strValue, BOOL bLoading) OVERRIDE
 Sets an attribute using IStringW objects.
 
LPCWSTR GetObjectClass () SCONST OVERRIDE
 Retrieves the object's class name.
 
int GetObjectType () SCONST OVERRIDE
 Retrieves the object's type.
 
BOOL IsClass (LPCWSTR lpszName) SCONST OVERRIDE
 Checks if the object is of a specific class.
 
BOOL GetAttribute (LPCWSTR strAttr, IStringW *pValue) SCONST OVERRIDE
 Retrieves an attribute value.
 
void OnInitFinished (IXmlNode *xmlNode) OVERRIDE
 Handles initialization completion.
 
void SetAttrHandler (FunAttrHandler attrHandler) OVERRIDE
 Sets the attribute handler.
 
virtual HRESULT DefAttributeProc (const SStringW &strAttr, const SStringW &strValue, BOOL bLoading)
 Default attribute processing.
 

Protected Member Functions

BOOL InitFromXml (IXmlNode *pNode) OVERRIDE
 Initializes the animation set from an XML node.
 
HRESULT OnAttrDuration (const SStringW &value, BOOL bLoading)
 Custom attribute handler for duration.
 
HRESULT OnAttrFillBefore (const SStringW &value, BOOL bLoading)
 Custom attribute handler for fillBefore.
 
HRESULT OnAttrFillAfter (const SStringW &value, BOOL bLoading)
 Custom attribute handler for fillAfter.
 
HRESULT OnAttrStartOffset (const SStringW &value, BOOL bLoading)
 Custom attribute handler for startOffset.
 
virtual HRESULT SetAttribute (const SNS::SStringW &amp;amp;amp;amp;strAttribName, const SNS::SStringW &amp;amp;amp;amp;strValue, BOOL bLoading=FALSE)
 Attributes for SAnimationSet.
 
- Protected Member Functions inherited from SAnimation
bool isCanceled ()
 Checks whether the animation is canceled.
 
void fireAnimationStart ()
 Notifies the animation listener that the animation has started.
 
void fireAnimationRepeat ()
 Notifies the animation listener that the animation has repeated.
 
void fireAnimationEnd ()
 Notifies the animation listener that the animation has ended.
 
int resolveSize (const SValueDescription &value, int size, int parentSize, int nScale)
 Converts the information in the description of a size to an actual dimension.
 
void ensureInterpolator ()
 Ensures that this animation has an interpolator. Will use an AccelerateDecelerateInterpolator if nothing else was specified.
 
float getScaleFactor ()
 Gets the scale factor that should be applied to pre-scaled values in an Animation. Such as the pivot points in ScaleAnimation and RotateAnimation.
 

Additional Inherited Members

- Static Public Member Functions inherited from SObjectImpl< IAnimation >
static int GetClassType ()
 Retrieves the class type.
 
static LPCWSTR GetClassName ()
 Retrieves the class name.
 
static LPCWSTR GetClassAlias ()
 Retrieves the class alias.
 
static void MarkAttributeHandled (SXmlAttr xmlAttr, bool bHandled)
 Marks an attribute as handled.
 
static bool IsAttributeHandled (SXmlAttr xmlAttr)
 Checks if an attribute is handled.
 
- Protected Attributes inherited from SAnimation
bool mEnded
 Set by getTransformation(long, STransformation) when the animation ends.
 
bool mStarted
 Set by getTransformation(long, STransformation) when the animation starts.
 
bool mCycleFlip
 Set by getTransformation(long, STransformation) when the animation repeats in REVERSE mode.
 
uint64_t mStartTime
 The time in milliseconds at which the animation must start.
 
long mStartOffset
 The delay in milliseconds after which the animation must start. When the start offset is > 0, the start time of the animation is startTime + startOffset.
 
long mDuration
 The duration of one animation cycle in milliseconds.
 
int mRepeatCount
 The number of times the animation must repeat. By default, an animation repeats indefinitely.
 
int mRepeated
 Indicates how many times the animation was repeated.
 
RepeatMode mRepeatMode
 The behavior of the animation when it repeats. The repeat mode is either RESTART or REVERSE.
 
SAutoRefPtr< IInterpolator > mInterpolator
 The interpolator used by the animation to smooth the movement.
 
IAnimationListener * mListener
 The animation listener to be notified when the animation starts, ends, or repeats.
 
ZAdjustment mZAdjustment
 Desired Z order mode during animation.
 
float mScaleFactor
 Scale factor to apply to pivot points, etc. during animation. Subclasses retrieve the value via getScaleFactor().
 
BOOL mFillBefore
 Indicates whether the animation transformation should be applied before the animation starts. The value of this variable is only relevant if mFillEnabled is true; otherwise, it is assumed to be true.
 
BOOL mFillAfter
 Indicates whether the animation transformation should be applied after the animation ends.
 
BOOL mFillEnabled
 Indicates whether fillBefore should be taken into account.
 
ULONG_PTR mUserData
 User data associated with the animation.
 
bool mPaused
 Indicates whether the animation is paused.
 
uint64_t mPauseTime
 The time at which the animation was paused.
 
- Protected Attributes inherited from TObjRefImpl< SObjectImpl< IAnimation > >
LONG m_cRef
 Reference count.
 
- Protected Attributes inherited from SObjectImpl< IAnimation >
SStringW m_strName
 
int m_nID
 
FunAttrHandler m_attrHandler
 

Detailed Description

Represents a group of Animations that should be played together.

The transformation of each individual animation are composed together into a single transform. If AnimationSet sets any properties that its children also set (for example, duration or fillBefore), the values of AnimationSet override the child values.

The way that AnimationSet inherits behavior from Animation is important to understand. Some of the Animation attributes applied to AnimationSet affect the AnimationSet itself, some are pushed down to the children, and some are ignored, as follows:

  • duration, repeatMode, fillBefore, fillAfter: These properties, when set on an AnimationSet object, will be pushed down to all child animations.
  • repeatCount, fillEnabled: These properties are ignored for AnimationSet.
  • startOffset, shareInterpolator: These properties apply to the AnimationSet itself.

Starting with android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH, the behavior of these properties is the same in XML resources and at runtime (prior to that release, the values set in XML were ignored for AnimationSet). That is, calling setDuration(500) on an AnimationSet has the same effect as declaring android:duration="500" in an XML resource for an AnimationSet object.

Definition at line 31 of file SAnimationSet.h.

Constructor & Destructor Documentation

◆ SAnimationSet()

SAnimationSet::SAnimationSet ( bool shareInterpolator = true)

Constructor to use when building an AnimationSet from code.

Parameters
shareInterpolatorPass true if all of the animations in this set should use the interpolator associated with this AnimationSet. Pass false if each animation should use its own interpolator.

Definition at line 303 of file SAnimationSet.cpp.

Member Function Documentation

◆ addAnimation()

void SAnimationSet::addAnimation ( IAnimation * a)

Add a child animation to this animation set. The transforms of the child animations are applied in the order that they were added.

Parameters
aPointer to the animation to add.

Definition at line 219 of file SAnimationSet.cpp.

◆ copy()

void SAnimationSet::copy ( const IAnimation * src)

Copies the properties of another animation to this animation.

Parameters
srcPointer to the source animation to copy from.

Definition at line 98 of file SAnimationSet.cpp.

◆ getDuration()

long SAnimationSet::getDuration ( )

Gets the duration of the AnimationSet. The duration of an AnimationSet is defined to be the duration of the longest child animation.

Returns
The duration in milliseconds.

Definition at line 198 of file SAnimationSet.cpp.

◆ getTransformation()

BOOL SAnimationSet::getTransformation ( uint64_t currentTime,
ITransformation * outTransformation )

Gets the transformation at a specific time. The transformation of an animation set is the concatenation of all of its component animations.

Parameters
currentTimeCurrent time in milliseconds.
outTransformationPointer to the transformation to apply.
Returns
TRUE if the transformation is valid, FALSE otherwise.

Definition at line 125 of file SAnimationSet.cpp.

◆ hasAlpha()

bool SAnimationSet::hasAlpha ( )

Checks if any child animation affects the alpha property.

Returns
TRUE if any child animation affects the alpha property, FALSE otherwise.

Definition at line 251 of file SAnimationSet.cpp.

◆ InitFromXml()

SNSBEGIN BOOL SAnimationSet::InitFromXml ( IXmlNode * pNode)
protected

Initializes the animation set from an XML node.

Parameters
pNodePointer to the XML node.
Returns
HRESULT indicating success or failure.

Definition at line 9 of file SAnimationSet.cpp.

◆ initialize()

void SAnimationSet::initialize ( int width,
int height,
int parentWidth,
int parentHeight,
int nScale )

Initializes the animation with the dimensions of the object and its parent.

Parameters
widthWidth of the object being animated.
heightHeight of the object being animated.
parentWidthWidth of the parent of the object being animated.
parentHeightHeight of the parent of the object being animated.
nScaleScale factor.

Definition at line 56 of file SAnimationSet.cpp.

◆ OnAttrDuration()

HRESULT SAnimationSet::OnAttrDuration ( const SStringW & value,
BOOL bLoading )
protected

Custom attribute handler for duration.

Parameters
valueThe duration value as a string.
bLoadingBoolean indicating if the attribute is being loaded.
Returns
HRESULT indicating success or failure.

Definition at line 28 of file SAnimationSet.cpp.

◆ OnAttrFillAfter()

HRESULT SAnimationSet::OnAttrFillAfter ( const SStringW & value,
BOOL bLoading )
protected

Custom attribute handler for fillAfter.

Parameters
valueThe fillAfter value as a string.
bLoadingBoolean indicating if the attribute is being loaded.
Returns
HRESULT indicating success or failure.

Definition at line 42 of file SAnimationSet.cpp.

◆ OnAttrFillBefore()

HRESULT SAnimationSet::OnAttrFillBefore ( const SStringW & value,
BOOL bLoading )
protected

Custom attribute handler for fillBefore.

Parameters
valueThe fillBefore value as a string.
bLoadingBoolean indicating if the attribute is being loaded.
Returns
HRESULT indicating success or failure.

Definition at line 35 of file SAnimationSet.cpp.

◆ OnAttrStartOffset()

HRESULT SAnimationSet::OnAttrStartOffset ( const SStringW & value,
BOOL bLoading )
protected

Custom attribute handler for startOffset.

Parameters
valueThe startOffset value as a string.
bLoadingBoolean indicating if the attribute is being loaded.
Returns
HRESULT indicating success or failure.

Definition at line 49 of file SAnimationSet.cpp.

◆ pause()

void SAnimationSet::pause ( )

Pauses the animation.

Definition at line 309 of file SAnimationSet.cpp.

◆ resume()

void SAnimationSet::resume ( )

Resumes the animation.

Definition at line 318 of file SAnimationSet.cpp.

◆ scaleCurrentDuration()

void SAnimationSet::scaleCurrentDuration ( float scale)

Scales the current duration of the animation.

Parameters
scaleScale factor.

Definition at line 116 of file SAnimationSet.cpp.

◆ SetAttribute()

virtual HRESULT SAnimationSet::SetAttribute ( const SNS::SStringW &amp;amp;amp;amp; strAttribName,
const SNS::SStringW &amp;amp;amp;amp; strValue,
BOOL bLoading = FALSE )
inlineprotectedvirtual

Attributes for SAnimationSet.

< Whether to share the interpolator with child animations. Duration of the animation in milliseconds. Whether the animation transformation should be applied before the animation starts. Whether the animation transformation should be applied after the animation ends. Delay before the animation starts in milliseconds.

Reimplemented from SAnimation.

Definition at line 196 of file SAnimationSet.h.

◆ setDuration()

void SAnimationSet::setDuration ( long durationMillis)

Sets the duration of every child animation.

Parameters
durationMillisThe duration of the animation, in milliseconds, for every child in this set.

Definition at line 244 of file SAnimationSet.cpp.

◆ setFillAfter()

void SAnimationSet::setFillAfter ( BOOL bFill)

Sets whether the animation transformation should be applied after the animation ends.

Parameters
bFillBoolean indicating whether to fill after.

Definition at line 277 of file SAnimationSet.cpp.

◆ setFillBefore()

void SAnimationSet::setFillBefore ( BOOL bFill)

Sets whether the animation transformation should be applied before the animation starts.

Parameters
bFillBoolean indicating whether to fill before.

Definition at line 271 of file SAnimationSet.cpp.


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