The LTS version
The following sections describe what's new in the LTS version of Coherent Prysm and how to migrate to it.
The goal of Coherent Prysm LTS is to provide workflows similar to the workflows of Flash. It's also our aim to make it possible to extend the generated content of Prysm with custom functionality easily. We feel like the introduction of frame scripts and custom JavaScript classes suits that goal as they provide multiple plugin points for an extension.
Major changes
- All Prysm animations are now generated in JavaScript. CSS animations are not generated.
- All Prysm related JavaScript functionality resides within the
window.prysmnamespace. - The runtime behavior of timelines is now identical to the runtime behavior of timelines in Flash. Symbols are spawned and despawned correctly.
- Frame scripts are now supported.
- The JavaScript classes assigned to symbols can be overridden with custom classes.
- Frame labels are now contained in the movie clip instances. The global animation collections are removed.
- The behavior of all timeline seeking methods (play, stop, gotoAndPlay(), gotoAndStop(), playFromTo()) are now well defined.
Minor changes
- Filters applied to frames now work correctly in all scenarios.
- The
cl-labels-keyattribute is removed. - All prysm generated scripts are now prefixed with CLPrysm.
- All prysm generated scripts are now implemented in a module-like fashion.
To find our more about how the JavaScript animation library is implemented go here.
Removed features
Legacy components have been removed.
The components exported by Prysm are a superior alternative.
Animation options have been removed.
All animation options aside from the play state have been removed, as they are incompatible with frame scripts and can be substituted with them.
Animation direction
The animation direction property can be substituted with the playbackRate property of timelines. self.playbackRate = -1 makes an animation go in reverse.
normalis the default behavior for timelines (self.playbackRate = 1);reverseis implemented via (self.playbackRate = -1). We have implemented UI that starts animations in reverse.- Setting it through a frame script causes a flicker on the first draw, as the timeline will be drawn at frame 0 and then have its frame scripts executed.
alternateis implemented by a frame script at frame 0 that hasself.playbackRate = 1and a script at the end of the animation (check node0 that hasself.playbackRate = -1).-
alternate-reverseis implemented likealternatebut with the animation started in reverse. -
Animation iteration count
Frame scripts are JS, hence random data can be attached to the self and this objects. Iteration count is implemented via a counter in the last frame.
if (self.iterationCount === undefined) {
self.iterationCount = 5;
}
--self.iterationCount;
if (self.iterationCount === 0) {
self.stop();
}
Animation fill mode
noneisn't defined in Animate.self.gotoAndStop(time)can move you to any frame.forwards- There are multiple variations, so we describe just a few.- When the direction is
normal(self.playbackRate > 0),forwardsis implemented either by extending the animation with 1 frame and adding aself.stop()script or by adding aself.gotoAndStop(lastFrame)in a frame script one frame after the animation duration - When the direction is
reverse(self.playbackRate < 0),forwardsis implemented with a frame scriptself.stop()at frame 0. backwards- There are multiple variations, so we describe just a few.- When the direction is
normal(self.playbackRate > 0),backwardsis implemented via aself.gotoAndStop(0)at the end of the animation. - When the direction is
reverse(self.playbackRate < 0),backwardsis implemented via aself.gotoAndStop(self.duration - 0.1)script placed at frame 0.
Reworked features
Event actions
- The
playaction no longer has an iteration count and wait to finish options.
The intent of the play action is to resume playing a stopped timeline, therefore, the iteration count and wait to finish options were redundant.
- The
Goto and playaction no longer has an iteration count and wait to finish options.
Similar to the play action, the Goto and play action seeks a timeline and resumes playing it. An iteration count and wait to finish parameters aren't well defined in that scenario.
Changes to the CLAnimations script
In the LTS version, all animation methods are defined on the prysmInstance.timeline member of DOM elements. Therefore, the CLAnimations script has been reworked and is now a script with utility methods. Our motivation was to be as backwards-compatible as possible. The following changes have been made:
- The file is now named
CLPrysmAnimations.jsto match the naming convention of the other generated scripts. - Only the
play,pause,gotoAndPlay,gotoAndStopandplayFromTomethods are left in the API. - The
animationIterationsandcallbackarguments are removed from theplayandgotoAndPlaymethods. - These methods did not work correctly in previous iterations and are ambiguous. Therefore, to match the behavior of Scaleform we have removed them.
- In some situations a frame script can be used to implement a
gotoAndPlaywith an iteration count and/or callback.- The
addMethodmethod can be leveraged to add dynamic frame scripts.
- The
Misc
Note: By default all animations are now infinite. A way to make them iterate a fixed amount of time is to add a self.stop() at the last frame of an animation.