Class SlideAnimation

java.lang.Object
com.codename1.presentation.SlideAnimation

public final class SlideAnimation extends Object

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.

  • 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
      • slide: 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
      • slide: the slide

      • step: 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
      • slide: the slide

      • step: the step playing

      • elapsed: milliseconds into it; a large value shows the step finished

      Returns

      element states by id, for SlideRenderer.paint

    • paintTransition

      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
      • g: the graphics

      • renderer: paints the slides

      • p: the presentation

      • from: the slide leaving, or null

      • fromStates: its element states, or null

      • to: the slide arriving, whose transition is played

      • toStates: its element states, or null

      • x: left of the slide area in pixels

      • y: top of it

      • scale: pixels per point

      • progress: 0 to 1