AnimationBinding

References
public sealed class AnimationBinding : IStorable
A single binding between an animation and one animatable object in the document.

Bindings reference their object by instance id rather than by reference, so a binding survives a document reload and tolerates an object which has been deleted and restored by an undo.

Constructors

AnimationBinding

#
public AnimationBinding(Guid objectId)
Create a new, enabled binding targeting a specific object.
objectId (Guid)Instance id of the object to animate.

AnimationBinding

#
public AnimationBinding(IReader reader)
Deserialisation constructor.
reader (IReader)

Properties

Enabled

#
public bool Enabled { get; set; }
Gets or sets whether this inding takes part in the animation.

End

#
public IObjectState End { get; set; }
Gets or sets the state this object holds on the last frame, or null to end at the highest state it can reach.

ObjectId

#
public Guid ObjectId { get; }
Gets the instance id of the animated object.

Start

#
public IObjectState Start { get; set; }
Gets or sets the state this object holds on the first frame, or null to start from the lowest state it can reach.

Methods

Resolve

#
public IAnimatableObject Resolve(Document document)
Resolve the animatable object this binding targets.
document (Document)Document to search.
The animatable object, or null if it is missing, not animatable, or unable to animate at this moment.

ResolveLimits

#
public bool ResolveLimits(IAnimatableObject animatable, out IObjectState start, out IObjectState end)
Work out the two states this binding actually animates between.

A limit which was never set falls back to the far end of whatever range the object can reach, so a new binding animates everything without having to store anything.

animatable (IAnimatableObject)Object to resolve against.
start (out IObjectState)State for the first frame.
end (out IObjectState)State for the last frame.
True if both limits came from this binding rather than from the object.

ResolveName

#
public string ResolveName(Document document)
Resolve the display name of the animated object, for use in user interfaces.
document (Document)

SeedLimits

#
public void SeedLimits(IAnimatableObject animatable)
Give this binding concrete limits, taken from the range its object reports, unless it already has them.

Done when an object joins an animation, so that the limits stop being a live reading of the object and become a decision. An object with no range of its own — a colour, say, which reports its current value for both ends — would otherwise have one limit follow it around while the other was being set, and the two would always agree.

animatable (IAnimatableObject)

Store

#
public void Store(IWriter writer)
This method is called whenever the instance is required to serialize itself.
writer (IWriter)Writer object to serialize with.
Store