# Transition2D Demo

## What Is It

The `Transition2D` abstract class provides a framework for defining a transition between two images using 2D-based rendering operations.

## How To Use It

There are dozens of transitions to choose from, but once you've decided what you want the invocation is simple:

    SwivelTransition2D t = new SwivelTransition2D();
    float progress = ...;
    t.paint(graphics2D, imgA, imgB, progress);

Here `progress` is a float that ranges from 0 (which will only show `imgA`) to 1 (which will only show `imgB`).

## How It Works

The only abstract method in the `Transition2D` class is:

    public abstract Transition2DInstruction[] getInstructions(float progress,
                                                              Dimension size);

All subclasses have to provide a series of `Transition2DInstruction` objects describing how to paint each layer of the transition. These instructions basically manipulate the transform, clipping and opacity of each image. (And in some cases add shapes.)

This concept is very similar to the `com.pump.graphics.vector.Operation` object. And someday I might refactor these two projects (the `VectorImage` and `Transition2D`) to use the `Operation` objects. The `Transition2DInstruction` are simpler in scope and could potentially lend themselves to exporting to other file formats, but in reality I don't see that happening any time soon.

## Examples

Bars Horizontal Random | Bars Horizontal | Bars Vertical Random | Bars Vertical
Blend | Blinds Left (4) | Blinds Left (10) | Blinds Left (20)
Blinds Right (10) | Blinds Up (10) | Blinds Down (10) | Box In
Box Out | Checkerboard Left | Checkerboard Right | Checkerboard Up
Checkerboard Down | Circle In | Circle Out | Collapse
Curtain | Diamonds (10) | Diamonds (20) | Diamonds (40)
Documentary Left | Documentary Right | Documentary Up | Documentary Down
Dots | Drop | Flurry In | Flurry Out
Funky Wipe Circular | Funky Wipe Across | Goo (10) | Goo (20)
Goo (50) | Halftone In | Halftone Out | Kaleidoscope
Levitate | Mesh Shuffle | Microscope | Mirage
Motion Blend | Refractive | Pivot Out Top Left | Pivot In Top Left
Pivot Out Top Right | Pivot In Top Right | Pivot Out Bottom Left | Pivot In Bottom Left
Pivot Out Bottom Right | Pivot In Bottom Right | Push Left | Push Down
Push Up | Push Right | Radial Wipe Clockwise | Radial Wipe Counterclockwise
Reveal Left | Reveal Right | Reveal Up | Reveal Down
Rotate In | Rotate Out | Scale In | Scale Out
Scribble | Scribble Twice | Slide Left | Slide Right
Slide Up | Slide Left | Spiral | Spiral Sprawl
Split Horizontal Out | Split Horizontal In | Split Vertical Out | Split Vertical In
Square Rain (6) | Square Rain (12) | Square Rain (24) | Squares (10x10)
Squares (30x30) | Squares (20x20) | Star In | Star Out
Stars Left | Stars Right | Swivel Counterclockwise | Swivel Clockwise
Toss Left | Toss Right | Wave Left | Wave Right
Wave Up | Wave Down | Wipe Up | Wipe Left
Wipe Down | Wipe Right | Zoom Left | Zoom Left Stationary
Zoom Right | Zoom Right Stationary