Gorilla.Animation
Unit Gorilla.Animation.pasClasses
- TElementVertices = class ( {System.Generics.Collections}TDictionary<System.Classes.TComponent,System.Generics.Collections.TDictionary<System.Word,Gorilla.DefTypes.TVertexData>> )
- TPropertyKeyAnimation = class ( TCustomPropertyAnimation )
- TPoint3DKey = class ( TKey )
- TPoint3DKeyAnimation = class ( TPropertyKeyAnimation )
- TVector3DKey = class ( TKey )
- TVector3DKeyAnimation = class ( TPropertyKeyAnimation )
- TQuaternion3DKey = class ( TKey )
- TQuaternion3DKeyAnimation = class ( TPropertyKeyAnimation )
- TTransformationKey = class ( TKey )
- TTransformationKeyAnimation = class ( TPropertyKeyAnimation )
- TCoordinateKey = class ( TKey )
- TCoordinateKeyAnimation = class ( TPropertyKeyAnimation )
- TSkeletonKeyAnimation = class ( TPropertyKeyAnimation )
- TGorillaAnimation = class ( TFmxObject )
- TGorillaAnimationManager = class ( TObject )
Constants
- const GORILLA_ANIMATION_DEFAULT : string = "Animation1";
TElementVertices
A hash map of component vertexdata pairs.
Ancestors
TPropertyKeyAnimation
The Gorilla3D specific property key animation as basis for TPoint3DKeyAnimation, TVector3DKeyAnimation, TTransformationKeyAnimation and TCoordinateKeyAnimation.
Ancestors
Members
Fields
- protected FQualifiedName :
string
- protected FElements :
TReferencedComponentList
- protected FDef :
TObject
- protected FKeys :
TKeys
- protected FStartFromCurrent :
Boolean
Methods
- public constructor Create ( AOwner : TComponent ) ;
- public destructor Destroy ( ) ;
- protected function FindPropertyAndInstance ( const AComp : TComponent; out AProp : TRttiProperty; out AInstance : TObject ) : Boolean ;
- public procedure AddElements
(
const
AElements :
TReferencedComponentList
)
;
Apply this specific key animation to a number of components.
- public procedure AddElement
(
const
AElement :
TComponent; const
AValue :
Boolean
)
;
Apply this specific key animation to a specific component.
- public procedure LoadFromInterpolatorDef
(
ADef :
TCustomDef
)
;
abstract virtual;
Loading a key animation from a specific TInterpolatorDef.
- public procedure ResetCaching
(
)
;
We need to reset the animation values we've manipulated while caching, to prevent access violations.
- public procedure ProcessCachingTick
(
time :
Single; deltaTime :
Single
)
;
We need a separated ProcessTick() method especially for caching, because some properties are not set while caching (f.e. IsRunning).
Properties
- public QualifiedName : string
A defined qualified identifier taken from importing a key animation from definition structures by LoadFromInterpolatorDef().
read FQualifiedName
write FQualifiedName - public Elements : TDictionary<System.Classes.TComponent,System.Boolean>
- public Def : TObject
- published Keys : TKeys
- published StartFromCurrent : Boolean
- published AnimationType : TAnimationType
- published AutoReverse : Boolean
- published Enabled : Boolean
- published Delay : Single
- published Duration : Single
- published Interpolation : TInterpolationType
- published Inverse : Boolean
- published Loop : Boolean
- published PropertyName : string
- published Trigger : TTrigger
- published TriggerInverse : TTrigger
TPoint3DKey
Single key structure stored a list of component-TPoint3D pairs.
Ancestors
Members
Fields
Methods
- public constructor Create ( Collection : TCollection ) ;
- public destructor Destroy ( ) ;
- private function GetValue ( AIndex : TComponent ) : TPoint3D ;
- private procedure SetValue ( AIndex : TComponent; const AValue : TPoint3D ) ;
- public procedure SetDefaultValue ( AValue : TPoint3D ) ;
- public function GetDefaultValue ( ) : TPoint3D ;
Properties
TPoint3DKeyAnimation
Defines a TPoint3D animation controlled by keys. Use this animation type for animating f.e. the position, scale or rotation of a specific FMX object, instead of creating a TFloatAnimation for each part of a TPoint3D property.
Ancestors
Members
Methods
- public constructor Create ( AOwner : TComponent ) ;
- public destructor Destroy ( ) ;
- protected procedure ProcessAnimation ( ) ; override;
- protected procedure FirstFrame ( ) ; override;
- protected function PointsEqual ( const P1 : TPoint3D; const P2 : TPoint3D ) : Boolean ;
- protected function InterpolatePoint3D ( const Start : TPoint3D; const Stop : TPoint3D; T : Single ) : TPoint3D ;
- public procedure LoadFromInterpolatorDef ( ADef : TCustomDef ) ; override;
TVector3DKey
Single key structure stored a list of component-TVector3D pairs.
Ancestors
Members
Fields
Methods
- public constructor Create ( Collection : TCollection ) ;
- public destructor Destroy ( ) ;
- private function GetValue ( AIndex : TComponent ) : TVector3D ;
- private procedure SetValue ( AIndex : TComponent; const AValue : TVector3D ) ;
- public procedure SetDefaultValue ( AValue : TVector3D ) ;
- public function GetDefaultValue ( ) : TVector3D ;
Properties
TVector3DKeyAnimation
Defines a TVector3D animation controlled by keys. Use this animation type for animating f.e. the position, scale or rotation of a specific FMX object, instead of creating a TFloatAnimation for each part of a TVector3D property.
Ancestors
Members
Methods
- public constructor Create ( AOwner : TComponent ) ;
- public destructor Destroy ( ) ;
- protected procedure ProcessAnimation ( ) ; override;
- protected procedure FirstFrame ( ) ; override;
- protected function InterpolateVector3D ( const Start : TVector3D; const Stop : TVector3D; T : Single ) : TVector3D ;
- public procedure LoadFromInterpolatorDef ( ADef : TCustomDef ) ; override;
TQuaternion3DKey
Single key structure stored a list of component-TQuaternion3D pairs.
Ancestors
Members
Fields
Methods
- public constructor Create ( Collection : TCollection ) ;
- public destructor Destroy ( ) ;
- private function GetValue ( AIndex : TComponent ) : TQuaternion3D ;
- private procedure SetValue ( AIndex : TComponent; const AValue : TQuaternion3D ) ;
- public procedure SetDefaultValue ( AValue : TQuaternion3D ) ;
- public function GetDefaultValue ( ) : TQuaternion3D ;
Properties
TQuaternion3DKeyAnimation
Defines a TVector3D animation controlled by keys. Use this animation type for animating f.e. the position, scale or rotation of a specific FMX object, instead of creating a TFloatAnimation for each part of a TVector3D property.
Ancestors
Members
Methods
- public constructor Create ( AOwner : TComponent ) ;
- public destructor Destroy ( ) ;
- protected procedure ProcessAnimation ( ) ; override;
- protected procedure FirstFrame ( ) ; override;
- protected function InterpolateQuaternion3D ( const Start : TQuaternion3D; const Stop : TQuaternion3D; T : Single ) : TQuaternion3D ;
- public procedure LoadFromInterpolatorDef ( ADef : TCustomDef ) ; override;
TTransformationKey
Single key structure stored a list of component-TMatrix3D pairs.
Ancestors
Members
Fields
Methods
- public constructor Create ( Collection : TCollection ) ;
- public destructor Destroy ( ) ;
- private function GetValue ( AIndex : TComponent ) : TMatrix3D ;
- private procedure SetValue ( AIndex : TComponent; const AValue : TMatrix3D ) ;
- public procedure SetDefaultValue ( AValue : TMatrix3D ) ;
- public function GetDefaultValue ( ) : TMatrix3D ;
Properties
TTransformationKeyAnimation
Defines a TMatrix3D animation controlled by keys. This animation type is especially used for manipulating joints of a skeleton or skin-animation. By this animation type you can easily manipulate Position, Scale and Rotation at once, instead of instanciating multiple animations for each part.
Ancestors
Members
Methods
- public constructor Create ( AOwner : TComponent ) ;
- public destructor Destroy ( ) ;
- protected procedure ProcessAnimation ( ) ; override;
- protected procedure FirstFrame ( ) ; override;
- protected function InterpolateMatrix3D ( const Start : TMatrix3D; const Stop : TMatrix3D; T : Single ) : TMatrix3D ;
- public procedure LoadFromInterpolatorDef ( ADef : TCustomDef ) ; override;
TCoordinateKey
Single key structure stored a list of component-TPoint3DDynArray pairs.
Ancestors
Members
Fields
Methods
- public constructor Create ( Collection : TCollection ) ;
- public destructor Destroy ( ) ;
- private function GetVertices ( AIndex : TComponent ) : TPoint3DDynArray ;
- private procedure SetVertices ( AIndex : TComponent; const AValue : TPoint3DDynArray ) ;
- public procedure SetDefaultValue ( AValue : TPoint3DDynArray ) ;
- public function GetDefaultValue ( ) : TPoint3DDynArray ;
Properties
- public Vertices[Index] : TPoint3DDynArray
Returns the key vertices for a specific component at the current key position.
read GetVertices
write SetVertices
TCoordinateKeyAnimation
Defines a Vertex animation controlled by keys. This animation type is used for vertex manipulation. Each key contains all mesh vertices and the animation interpolates between those keys.
Ancestors
Members
Methods
- public constructor Create ( AOwner : TComponent ) ;
- public destructor Destroy ( ) ;
- protected procedure ProcessAnimation ( ) ; override;
- protected procedure FirstFrame ( ) ; override;
- protected function InterpolateCoordinates ( const Start : TPoint3DDynArray; const Stop : TPoint3DDynArray; T : Single ) : TPoint3DDynArray ;
- protected procedure Precalculate ( ) ;
- public procedure LoadFromInterpolatorDef ( ADef : TCustomDef ) ; override;
TSkeletonKeyAnimation
The SkeletonKeyAnimation is Helper-Animation for skeleton- / skin-animations. Here often many joints come with an animation. Due to async handling of each interpolator (joint), there could be tiny offsets which lead to massive graphics disposition-effects.
Remarks
The SkeletonKeyAnimation instance holds a number of TPropertyKeyAnimation instances. None of those animations are really executed. The SkeletonKeyAnimation executes the ProcessTick() routine of each interpolator instead of the asynchronous animation thread.Ancestors
Members
Fields
Methods
- public constructor Create ( AOwner : TComponent ) ;
- public destructor Destroy ( ) ;
- protected procedure ProcessAnimation
(
)
;
override;
Overrides the internal ProcessAnimation routine, updates time information of each added interpolator and calls afterwards ProcessAnimation for each child interpolator. The animation itself has no animation support, it's only used for grouping PropertyKeyAnimations.
- public procedure LoadFromInterpolatorDef ( ADef : TCustomDef ) ; override;
- public procedure AddInterpolator
(
AInter :
TPropertyKeyAnimation
)
;
Adds a new interpolator to the grouping animation and enables the specific interpolator.
- public procedure Reset
(
)
;
Iterates through all child interpolators and resets time information by ProcessTick(0, 0). This will reset animation of each interpolator to starting position.
- public procedure SetSpeed
(
const
ASpeed :
Single
)
;
Use this method to scale animation speed. The method will iterate through all child interpolators and call their SetSpeed method with the supplied parameter.
- public procedure Start ( ) ; override;
- public procedure Stop ( ) ; override;
Properties
- public Interpolators : TObjectList<Gorilla.Animation.TPropertyKeyAnimation>
Returns the list of grouped interpolators. Do not use Interpolators.Add()! Use the AddInterpolator() method to add a new interpolator to the animation group. Otherwise the specific interpolator may not be able to run.
read FInterpolators - published AutoRepaint : Boolean
By the AutoRepaint property you can control the update mechanism. By default (TRUE) the SkeletonKeyAnimation will automatically call Repaint() after each ProcessAnimation() call. This means with every animation step an update process is initiated. If you want to control repainting yourself by BeginUpdate/EndUpdate of the TGorillaViewport, set this property to FALSE.
read FAutoRepaint
write FAutoRepaint
TGorillaAnimation
Ancestors
Members
Fields
- protected FDef :
TAnimationDef
- protected FManager :
TGorillaAnimationManager
- protected FSkeleton :
TSkeletonKeyAnimation
- protected FTimerService :
IFMXTimerService
- protected FBeginTime :
Double
- protected FDuration :
Double
- protected FFrameCount :
Integer
- protected FFrameRate :
Integer
Methods
- public constructor Create ( const AManager : TGorillaAnimationManager ) ;
- public destructor Destroy ( ) ;
- protected function GetIsRunning ( ) : Boolean ;
- protected function GetIsPaused ( ) : Boolean ;
- public procedure LoadFromAnimationDef ( ADef : TAnimationDef ) ; virtual;
- public procedure Start ( ) ; virtual;
- public procedure Stop ( ) ; virtual;
- public procedure Reset ( ) ; virtual;
- public procedure SetSpeed ( const ASpeed : Single ) ;
- public function GetCurrentCachedFrame ( const AMeshDef : TMeshDef ) : TMeshBufferObject ;
- public function SearchUpwardsForComponent ( const AClass : TClass ) : TFmxObject ;
- public function GetParentViewport ( ) : TFmxObject ;
Properties
- public Def : TAnimationDefread FDef
- public Manager : TGorillaAnimationManager
- public Skeleton : TSkeletonKeyAnimation
Returns the skeleton helper interpolator which holds all sub interpolators for faster animation.
read FSkeleton - public IsRunning : Boolean
- public IsPaused : Boolean
TGorillaAnimationManager
Ancestors
Members
Fields
- protected FMesh :
TObject
- protected FCurrent :
TGorillaAnimation
- protected FAnimations :
TGorillaAnimationMap
Methods
- public constructor Create ( const AMesh : TObject ) ;
- public destructor Destroy ( ) ;
- protected procedure SetCurrentAnimation ( const AValue : TGorillaAnimation ) ;
- protected function GetCurrentAnimation ( ) : TGorillaAnimation ;
- protected procedure DoOnValueNotify ( ASender : TObject; const AItem : TGorillaAnimation; AAction : TCollectionNotification ) ;
- public function GetFirstAnimation
(
)
: TGorillaAnimation
;
Returns the first animation can be found in animations map.
- public function GetLastAnimation
(
)
: TGorillaAnimation
;
Returns the last animation can be found in animations map.
- public function GetAnimation
(
const
AId :
string
=
)
: TGorillaAnimation
;
overload;
Returns an animation instance identified by its id.
- public function GetAnimation
(
const
ADef :
TAnimationDef
)
: TGorillaAnimation
;
overload;
Returns an animation instance based on a specific animation definition.
- public function AddAnimation
(
const
AId :
string; const
AAnimation :
TGorillaAnimation
)
: TGorillaAnimation
;
Adds a new animation by id to the animation manager.
- public function PlayAnimation
(
const
AId :
string
)
: TGorillaAnimation
;
overload;
Sets the current animation to an animation with the supplied id.
- public function PlayAnimation
(
const
AAnim :
TGorillaAnimation
)
: TGorillaAnimation
;
overload;
Sets the current animation to an animation with the supplied animation.
- public function PlayNextAnimation
(
)
: TGorillaAnimation
;
Starts the next animation in row. If no current animation is running, the method will start the first animation it can find. If there is no next animation, the first animation will be played again. If no animation exists, the routine returns nil.
- public function PlayPreviousAnimation
(
)
: TGorillaAnimation
;
Starts the previous animation in row. If no current animation is running, the method will start the last animation it can find. If there is no previous animation, the last animation will be played again. If no animation exists, the routine returns nil.