Skip to end of metadata
Go to start of metadata

Description

The Transitions plugin enables animated transitions based on Jeremy's work on Transition2D and Kirill's Trident Animation Library. It does so by providing a TransitionLayout capable of handling a Transition2D per child component. This work is inspired by Animating CardLayout

Installation

The current version of griffon-transitions-plugin is 0.5
To install just issue the following command

Usage

You'll need an instance of TransitionLayout in order to add animated transitions to your application. You'll use this class in the same way as you would cardLayout(), the only distinction being the type of object that is used to set the child component's constraints.
When the constraints is a String instance then the animated transition will use the layout's default values for duration and transition. When the constraints is a Map it will look for keys duration and transition, applying default values when no keys are found.

This plugin contributes the following nodes

Node

Property

Type

Default

Required

Bindable

Notes

transitionLayout
[TransitionLayout]

defaultDuration

long

500L

(error)

(error)

 

 

defaultTransition

Transition2D

BlendTransition2D

(error)

(error)

 

 

mirrorTransition

boolean

true

(error)

(error)

 

 

skipTransitions

boolean

false

(error)

(error)

 

 

beforeCallback

Runnable

null

(error)

(error)

invoked before a transition starts

 

afterCallback

Runnable

null

(error)

(error)

invoked after a transition ends

The following example shows a panel with 3 child components. The first child component will use default values for duration and transition; the second one specifies a different value for its duration; lastly the third component defines values for both constraints.

You can trigger a transition by calling one of the following methods on the layout's instance: next(), previous(), first(), last(), show(). Example

TransitionLayout will mirror a transition when navigating a page in reverse. Suppose that top is showing page1, if a call to previous() is issued then a reverse transition (from: being page0 and to: being page1) using page0's transition will be called. You can change this feature by setting mirrorsTransition (on the layout) to false, then when navigating from page1 to page0 results in a forward transition (from: being page1 and to: being page0) using page1's transition value.
TransitionLayout can skip animating a transition by setting skipTransitions to true.

There are two new Transition2D classes besides the ones provided by the Transition2D project:

  • griffon.transitions.FadeTransition2D - takes a Color as argument on its constructor
  • griffon.transitions.ShapeTransition2D - takes a Shape and a String as arguments on its constructor

TransitionPicker is a sample Griffon application that showcases all Transition2D classes.

Methods

The following methods can be used with TransitionLayout:

Navigation

  • void first(Container c) -
  • void next(Container c) -
  • void previous(Container c) -
  • void last(Container c) -
  • void show(Container c, String name) -

Queries

  • int getCardCount() -
  • boolean isAnimating() -
  • String cardNameAt(int index) -
  • int cardIndexOf(String name) -
  • String getCurrentCardName(Container c) -
  • int getCurrentCardIndex(Container c) -

History

Version

Date

Notes

0.5

05-17-11

Release sync with Griffon 0.9.3

0.4.1

02-22-11

Upgraded dependencies

0.4

12-21-10

Release sync with Griffon 0.9.2

0.3

07-22-10

Release sync with Griffon 0.9

0.2

03-01-10

Upgraded to Griffon 0.3

0.1.3

12-09-09

added transitionLayout() node and ShapeTransition2D transition

0.1.1

09-09-09

added skipTransitions property to TransitionLayout

0.1

08-25-09

first release

  • No labels