Animations
There are two types of animations in the presentation library: slide intro animations, and element animations. The included ones are presented here below.
Slide Intro Animations
Slide intro animations need to have names that end with Intro to be usable from the presentation
language (the presentation language automatically adds the suffix Intro before resolving the
name). The following ones are included in the library, but custom ones can be created as well:
-
FadeInFades in using transparency. The duration can optionally be specified as a parameter.
-
SlideDown <fade>Slide down from the top. If
<fade>is true, then the slide is faded in as well. A custom duration can be specified as the first parameter. -
EnlargeEnlarge the old slide and fade it out. A custom duration can optionally be specified as a parameter.
Custom Intro Animations
To create custom animations, simply create a new subclass to presentation.SlideIntro,
and override the draw member.
Element Animations
Element animations need to have names that end in Animation to be usable from the presentation
language (the presentation language automatically adds the suffix Animation before resolving the
name). The following animations are provided by the library:
-
ShowDisplay the element at the specified step. No animation.
-
HideStop showing the element at the specified stop. No animation.
-
FadeInFades the element in from transparent.
-
FadeOutFades the element out to transparent.
-
RaiseAnimation that fades the element in from transparent, but also raises the object while doing so. The height to raise the element can optionally be specified as a parameter.
-
GrowGrow the element vertically.
-
ShrinkShrink the element vertically.
-
ZoomInZoom the element in. Like
Growbut affects both dimensions. -
ZoomOutZoom the element out. Like
Shrinkbut affects both dimensions.
Custom Element Animations
To create custom element animations, simply create a subclass to presentation.Animation.
The subclass must have a constructor that accepts at least one Nat. The presentation language
passes the step to which the animation applies as the first parameter. This is expected to be
forwarded to the superclass' constructor.
The class then needs to override the following two members:
The following convenience functions are also available to simplify implementation of animations:
Finally, there are a few convenience classes that perform some common tasks:
-
presentation.TriggerAn animation that acts like a trigger, i.e. it triggers once at the desired time and does something at that moment only. This class is intended to provide functionality to other embedded things, and has no real use in isolation as-is.
-
presentation.AnimationIntroInterface to simplify animations that animate the entrance of an object.
Adapts the interface of Animation into an interface that is simpler to use, but less flexible.
-
void before(presentation.Element element, ui.Graphics g, core.Float pos)Override to update the graphics context. Expected to call "push" in some form. "pos" is a float in range 0..1 indicating the current position of the animation.
-
void after(presentation.Element element, ui.Graphics g)Override to restore the graphics context. Default implementation simply pops it once.
-
-
presentation.AnimationOutroInterface to simplify animations that animate the disappearence of an object.
Adapts the interface of Animation into an interface that is simpler to use, but less flexible.
-
void before(presentation.Element element, ui.Graphics g, core.Float pos)Override to update the graphics context. Expected to call "push" in some form. "pos" is a float in range 0..1 indicating the current position of the animation.
-
void after(presentation.Element element, ui.Graphics g)Override to restore the graphics context. Default implementation simply pops it once.
-
