IAnimatableObject

References
public interface IAnimatableObject
Implemented by document objects which can be driven by an animation. An animatable object can snapshot its own state, describe the two extremes it is able to reach, and move itself to the state belonging to a frame.

Properties

CanAnimate

#
bool CanAnimate { get; }
Gets whether this object can currently be animated. An object which returns false is skipped, even if an animation binding targets it.

Methods

Animate

#
IObjectState Animate(IObjectState start, IObjectState end, long currentFrame, long totalFrames)
Move this object to the state belonging to a frame.

currentFrame runs from zero to totalFrames minus one: frame zero is start and the final frame is end. When the start and end states are identical, or when the totalFrames equals zero, the animation server is putting this object back into an original (not-animated) state.

Implementers must change the state of the object to match the interpolated animation states, but they should *not* record undo events or trigger new solutions.

start (IObjectState)State belonging to frame zero.
end (IObjectState)State belonging to the final frame.
currentFrame (long)Index of the frame to apply.
totalFrames (long)Number of frames spanning the two states.
The state which was applied.

GetCurrentState

#
IObjectState GetCurrentState(out IObjectState lowest, out IObjectState highest)
Snapshot the current state of this object, along with the two extremes it can reach.
lowest (out IObjectState)The lowest state this object can hold.
highest (out IObjectState)The highest state this object can hold.
The current state.

SuggestedFrameCount

#
long SuggestedFrameCount(IObjectState start, IObjectState end)
Gets the number of frames which would suit an animation between two states, or zero if this object has no opinion.

An object with a finite number of states answers with how many of them lie between the two, so the animation visits each exactly once. An object of unlimited accuracy — an angle or a number line, say — answers with whatever sampling is natural over that range instead, since it is the one which knows what a sensible step through its own values looks like. Nothing else is in a position to guess.

It depends on the states because the range does: a slider covering a tenth of its domain has a tenth of the values to visit.

Both states are always supplied. A binding with no limits of its own passes the extremes this object reported from GetCurrentState(IObjectState, IObjectState), so there is never a missing state to defend against — only, as ever, the possibility of one belonging to some other object.

start (IObjectState)State belonging to the first frame.
end (IObjectState)State belonging to the last frame.