Animation
Type class
Animation can be used to transition certain properties on an object that implements IAnimatable interface.
More info: IAnimationEvents for a list of available events
Sources
Animation can be used (imported) via one of the following packages.
/** * Import from: "core.ts" * Use like: am4core.Animation */import * as am4core from "@amcharts/amcharts4/core";/** * Include via: <script src="core.js"></script> * Access items like: am4core.Animation */Inheritance
Animation extends BaseObjectEvents.
Animation is not extended by any other symbol.
Properties
animationOptionsType
IAnimationOptions[]An array of animation option objects. Each animation object represent one property. Animation can animate any number of properties simultaneously.
delayedType
booleanReturns
trueif this animation is delayed.durationType
numberDefault0Duration of the animation in milliseconds.
easingType (value:
number) =>numberDefault$ease.linearEasing function to use.
More info:
EaseobjectType
IAnimatableAn animation target object.
Animationwill update properties of this object.progressType
numberDefault0Contains progress of the current animation: 0 (start) to 1 (end).
5 inherited items
clonedFromType
$type.Optional<this>Inherited fromBaseObjectReference to the original object this object was cloned from. We need to keep this so we can disassociate it from source object when this object is disposed.
configType
objectInherited fromBaseObjectUse this property to set JSON-based config. When set, triggers processing routine, which will go through all properties, and try to apply values, create instances, etc.
Use this with caution, as it is a time-consuming process. It's used for initialchart setup only, not routine operations.
eventsType
EventDispatcher<AMEvent<this,IBaseObjectEvents>>Inherited fromBaseObjectEventsAn
EventDispatcherinstanceidType
$type.Optional<string>Inherited fromBaseObjectSets the user-defined id of the element.
uidType
stringInherited fromBaseObjectReturns object's internal unique ID.
Methods
constructor(object:IAnimatable,
animationOptions:IAnimationOptions[]|IAnimationOptions,
duration:number,
easing?: (value:number) =>number)Returns
AnimationConstructor
delay(delay:number)Returns
AnimationDelays animation start by X milliseconds.
dispose()Returns
voidDisposes this object, clears up after itself.
end()Returns
AnimationJumps to animation end. If animation is set to loop, this will start another round of animation from start.
isFinished()Returns
booleanReturns indicator if this animation is finished or not
kill()Returns
voidStops animation immediately leaving properties in their current values.
loop(count?:number)Returns
AnimationSets loop count for the animation. If parameter is not a valid number the animation will keep on looping indefinitely.
pause()Returns
AnimationPauses animation.
resume()Returns
AnimationResumes paused animation.
setProgress(progress:number)Returns
voidSets current progress and updates object's numeric and color values.
start()Returns
AnimationStarts animation.
stop(skipEvent?:boolean)Returns
AnimationStops animation.
When animation is stopped, the properties of the target object will remain where they were at the moment when
stop()was called.
6 inherited items
clone(cloneId?:string)Returns
thisInherited fromBaseObjectMakes a copy of this object and returns the clone. Try to avoid cloning complex objects like chart, create new instances if you need them.
copyFrom(source:this)Returns
voidInherited fromBaseObjectEventsCopies all parameters from another
Sprite.dispatch(eventType:Key,
data?:any)Returns
voidInherited fromBaseObjectEventsDispatches an event using own event dispatcher. Will automatically populate event data object with event type and target (this element).
It also checks if there are any handlers registered for this sepecific event.
dispatchImmediately(eventType:Key,
data?:any)Returns
voidInherited fromBaseObjectEventsWorks like
dispatch, except event is triggered immediately, without waiting for the next frame cycle.getCurrentThemes()Returns
ITheme[]Inherited fromBaseObjectReturns a list of themes that should be applied to this element. It could either be a list of themes set explicitly on this element, or system-wide.
isDisposed()Returns
booleanInherited fromBaseObjectReturns if this object has been already been disposed.
Events
animationendedParam { type:
"animationended", target:Animation, progress:number}Invoked when animation finishes playing.
animationprogressParam { type:
"animationprogress", target:Animation, progress:number}Invoked when animation makes progress.
animationstartedParam { type:
"animationstarted", target:Animation, progress:number}Invoked when animation starts playing.
animationstoppedParam { type:
"animationstopped", target:Animation, progress:number}Invoked when animation is stopped by some other process, before it had a chance to finish.