Animation
ReferencesAn animation holds no live state of its own. Running one is the job of the AnimationServer, which may run the same animation any number of times.
Constructors
Fields
Extension
#MaximumFrameCount
#Properties
BaseFolder
#CanvasFixedResolution
#CanvasHeight
#CanvasRegion
#Whole units on purpose. Object pivots are integers, so an integer region at an integer zoom puts every capsule edge on a whole pixel; a region picked at a fractional offset would shift the entire capture by that fraction and blur every edge at 100%.
An empty region means none has been picked yet. EnsureCanvasRegion(Document) replaces it with one framing the whole document, which the animation window does the moment it shows an animation and the server does before a run.
With a fixed resolution only the centre of an assigned region is kept, the size follows from the resolution and the zoom. Otherwise the region is taken as is and the resolution is recomputed.
CanvasTemplate
#CanvasWidth
#The three canvas quantities, region, zoom and pixel size, are tied together by size = region × zoom. Which of them gives way is decided by CanvasFixedResolution: with a fixed resolution the region is resized about its centre to keep the equation true, otherwise the size is recomputed. A size assigned while the resolution is free stands only until the next region or zoom change overwrites it.
CanvasZoom
#With a fixed resolution a new zoom resizes the region about its centre, otherwise it recomputes the resolution.
CustomFolder
#Cyclic
#A one-shot animation spreads its frames over the closed unit interval, so the final frame lands exactly on the final state. A cyclic animation spreads them over the half-open interval instead, so the final frame stops one step short and the loop does not stutter on a repeated frame.
Duration
#Duration is not stored. It is the frame count divided by the rate, and setting it picks the frame count which comes closest at the current rate.
Folder
#FrameRate
#The rate changes nothing about the images which get written, only how long they are meant to take on playback, which is why it is deliberately left out of the fingerprint: changing it must not invalidate a folder full of frames.
Id
#ImageCount
#A looping animation writes one fewer than its frame count. Its first and last frames are the same picture — that is what makes it loop — so the last one is simply not written, and playback wraps from the second to last frame back to the first in a single step.
Stopping one step short by resampling instead would not work: an object with exactly as many states as there are frames would have to squeeze them all into one step fewer, which visits one state twice somewhere in the middle. The stutter is not removed by that, only moved.
IsDefault
#The name and the id are not part of the test. A fresh animation is named after whatever document it turned up in, and renaming a thing which still animates nothing is not a reason to keep it. Neither is the viewport name, which the window writes for itself rather than taking from the user.
Anything else the window sets without being asked to must be left out of the comparison as well, or a placeholder stops looking like one the moment it is displayed and starts being saved.
Compared against a newly built animation rather than against a list of literals, so the defaults are stated in one place. A setting added to this class does have to be added to the comparison below, or an animation carrying it will pass for empty.
PostProcess
#This is declared before a run rather than chosen after one, so that starting a long animation and walking away still ends with a video. It runs only when the run completed: a cancelled run leaves a gap in the sequence, and every encoder would stop at that gap and silently produce a short film.
ResolvedFolder
#Unless a custom folder is set this follows the animation name, so renaming an animation moves where its images go. Frames already written stay where they were, under the old name, and are no longer found by a resume.
ViewportName
#ViewportTemplate
#Methods
Add
#| objectId (Guid) |
EnsureCanvasRegion
#| document (Document) | Document to frame. |
Fingerprint
#Deliberately excluded are the animation name and the binding order, neither of which changes a single pixel.
FormatFileName
#FrameCanvasRegion
#| target (RectangleF) | Rectangle to frame, in canvas coordinates. |
Remove
#| objectId (Guid) |
ResolveTracks
#Resolve every binding which is going to take part, together with the object it drives, so a run can animate between the limits the binding actually holds.
| document (Document) |
SuggestFrameCount
#| document (Document) |