AnimationKit.Task
AnimationKit.Task is the parent class for all animations. It controls things like frame delays and general animation status information.
Events
Event Completed ()
When the task has finished executing, after the final Perform event, the Completed
event will fire. Will not fire if the task was cancelled.
Event Perform (Final As Boolean, Time As Double)
The current state of the animation should be updated. Will not fire if the object referenced by the Item property has gone out of scope. If Final
is true, this is the last Perform
event that will be fired for this task.
The Time
parameter is a value returned by the Xojo Microseconds
method used to coordinate the execution times of multiple animations. It is strongly recommended that developers calculate based on the Time
parameter, and not by the value returned by Microseconds
.
Event Started ()
The Started
event triggers immediately before the first Perform
event.
Properties
Cancelled As Boolean // Read Only
Cancelled
will be true if either the Cancel
method has been called, or the object referenced by the Item
property has gone out of scope. The task can no longer execute, and no more Perform
events will trigger. Chained tasks will not be started.
Item As Object = Nil
The target of the animation. This is a weak reference, so that when the target goes out of scope, the animation will automatically cancel.
LastFrameTime As Double // Read Only
The time in microseconds that the last Perform
event was triggered.
NextTask As AnimationKit.Task = Nil
When this task has completed, automatically start the task referenced in this property. The new value will always be set to the end of the chain. To break the chain, set this property to Nil
. To replace an item in the chain, rather than append, set this property to Nil
first, then to the intended value.
Started As Boolean // Read Only
The animation has started.
Methods
Sub Cancel ()
Stops the animation where it is.
Sub Completed ()
Triggers an UnsupportedOperationException
. Subclasses must override so the framework knows when a task is complete and can move on to the next task in the chain.
Function ElapsedTime (Time As Double) As Double
Amount of time in microseconds since Time
that has elapsed since the task started execution.
Sub Perform (Time As Double)
Does some status checking and triggers the Perform
event if necessary.
Sub Run ()
Begin the animation using the application global coordinator.
Sub Run (Coordinator As AnimationKit.Coordinator)
Begin the animation using the coordinator specified.
Subclassing
Developers can create subclasses to implement new forms of animation.
The Completed
method must be overridden.