pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Bartlett <cbartlet...@gmail.com>
Subject Re: run FadeTransition in reverse?
Date Sat, 19 Feb 2011 13:39:22 GMT
As I understand it, a Transition handles changes of state from an initial
state 'A' to an end state 'B'.  (Note that the start and end states might
actually be the same, and the middle states would be adjustments from this
'normal' state)  In this case, the transition will move from state A to
state B, which I will call 'forwards'.

The reverse() method allows the direction of a *running* transition to be
toggled so that it will run 'backwards'. (or 'forwards' if called yet
again...)  This might be used to back out of a running transition, such as
cancelling the show Sheet transition if the escape key is pressed.

The getPercentComplete() method will generally be used by the update()
method of a concrete Transition implementation to determine the current
position along the transition timeline.

A quick & dirty solution might be
Transition fadeInTransition = new FadeTransition(component, duration, rate)
{
  public float getPercentComplete() {
    return 1f - super.getPercentComplete();
  };
};

Of course, you could also create your own fade transition class based on the
existing FadeTransition one, and incorporate the above along with a
Direction enum or boolean flag allowing the same transition instance to be
reused for fading a component in and out.

Chris

On 19 February 2011 07:56, Bill van Melle <bill.van.melle@gmail.com> wrote:

> This ought to be a simple question, but there's scant documentation about
> transitions...
>
> There's a class FadeTransition, which when run fades out a component.  Is
> there a way to run it backwards to fade in a component?  There's a reverse
> method, but I don't understand what it's supposed to do exactly.
>

Mime
View raw message