Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public final class SlideAnimation
- Object
- SlideAnimation
The timing of a slide’s builds and the frames of its transitions, as pure functions of
progress. SlideShow plays them against the animation clock; a test or a thumbnail strip
renders any frame of them deterministically.
A slide’s builds play in steps: each Build.ON_CLICK build starts a step, and the
WITH_PREVIOUS and AFTER_PREVIOUS builds after it belong to the same step. Builds
before the first click build form step 0, which plays as soon as the slide appears.
Methods
public static int clickSteps(Slide slide) | The number of steps a slide’s builds take, not counting the automatic first one when it is empty. |
public static int stepDuration(Slide slide, int step) | How long a step takes in milliseconds. |
public static Map<String, SlideRenderer.ElementState> states(Slide slide, int step, long elapsed) | The state of every built element while step is elapsed milliseconds in: the builds of earlier steps are done, later ones not yet started. |
public static void paintTransition(Graphics g, SlideRenderer renderer, Presentation p, Slide from, Map<String, SlideRenderer.ElementState> fromStates, Slide to, Map<String, SlideRenderer.ElementState> toStates, int x, int y, float scale, float progress) | Paints a frame of the transition into to: the slide leaving is from, which may be null for the first slide. |
Inherited methods
Method details
clickSteps
public static int clickSteps(Slide slide)The number of steps a slide’s builds take, not counting the automatic first one when
it is empty.
Parameters
slideSlide- the slide
Returns
the click count to get through every build
stepDuration
public static int stepDuration(Slide slide, int step)How long a step takes in milliseconds.
Parameters
slideSlide- the slide
stepint- the step, 0 for the automatic one
Returns
the duration, 0 for a step with no builds
states
public static Map<String, SlideRenderer.ElementState> states(Slide slide, int step, long elapsed)The state of every built element while
step is elapsed milliseconds in: the
builds of earlier steps are done, later ones not yet started.Parameters
slideSlide- the slide
stepint- the step playing
elapsedlong- milliseconds into it; a large value shows the step finished
Returns
element states by id, for
SlideRenderer.paintpaintTransition
public static void paintTransition(Graphics g, SlideRenderer renderer, Presentation p, Slide from, Map<String, SlideRenderer.ElementState> fromStates, Slide to, Map<String, SlideRenderer.ElementState> toStates, int x, int y, float scale, float progress)Paints a frame of the transition into
to: the slide leaving is from, which may be
null for the first slide. Both slides are drawn into a box of w by h pixels at
(x, y).Parameters
gGraphics- the graphics
rendererSlideRenderer- paints the slides
pPresentation- the presentation
fromSlide- the slide leaving, or null
fromStatesMap<String, SlideRenderer.ElementState>- its element states, or null
toSlide- the slide arriving, whose transition is played
toStatesMap<String, SlideRenderer.ElementState>- its element states, or null
xint- left of the slide area in pixels
yint- top of it
scalefloat- pixels per point
progressfloat- 0 to 1