Scratch for Java

Transition()

How one stage gives way to the next in window.transitionToStage(\u2026). A transition is a small shader that mixes the old stage's picture (from) and the new one's (to) by progress, from 0 to 1; the built-in ones cover the usual cases, and fromShader(String) makes one of your own:

void main() {
  color = mix(texture(from, uv), texture(to, uv), progress);
}

During a transition the old stage stands still, the new stage's run() starts once the transition is over, and input is ignored.

Static Fields

Name Type Description
FADE Transition Fades the old stage to black, then the new one in.
CROSSFADE Transition Blends the old stage into the new one.
SLIDE_LEFT Transition The new stage pushes the old one out to the left.
SLIDE_RIGHT Transition The new stage pushes the old one out to the right.
SLIDE_UP Transition The new stage pushes the old one out upwards.
SLIDE_DOWN Transition The new stage pushes the old one out downwards.
Transition()

Create Shareable URL

Select Sections