Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


oracle.ide.controls
Class Animator

java.lang.Object
  extended by oracle.ide.controls.Animator


public final class Animator
extends java.lang.Object

The Animator helps to implement animated transition in swing components. The class

Here is a typical example of an animated transition:

 final PropertyChangeListener propertyChangeListener = new PropertyChangeListener()
    {
      public void propertyChange(PropertyChangeEvent evt)
      {
        final Double newValue = (Double) evt.getNewValue();
        final double r = newValue.doubleValue();
        drawerElement.setBounds(
                (int) (sourceBounds.x + (destBounds.x - sourceBounds.x) * r),
                (int) (sourceBounds.y + (destBounds.y - sourceBounds.y) * r),
                (int) (sourceBounds.width + (destBounds.width - sourceBounds.width) * r),
                (int) (sourceBounds.height + (destBounds.height - sourceBounds.height) * r)
        );
        final Graphics g = getGraphics();
        paint(g);
      }
    };
    Animator.animate(30, 600, 10, 0.6, 0.14, propertyChangeListener);
See Also:
animate(int, long, java.beans.PropertyChangeListener)

Method Summary
static void animate(int stepTime, long maxTime, int steps, double center, double sigma, java.beans.PropertyChangeListener listener)
          Calculates transitions values between 0.0 and 1.0 and invokes the listener with each transition value.
The number of transitions is controlled by the steps parameter.
The acceleration and deceleration are controlled by the center and sigma parameters.
The animation rendering is usually too fast on an average computer and must be slowed down.
static void animate(int stepTime, long maxTime, java.beans.PropertyChangeListener listener)
           
static int getInt(double currentValue, int from, int to)
           
static java.awt.Point getPoint(double currentValue, java.awt.Point ptFrom, java.awt.Point ptTo)
           
static java.awt.Rectangle getRectangle(double currentValue, java.awt.Rectangle rcFrom, java.awt.Rectangle rcTo)
           

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Method Detail

getInt

public static int getInt(double currentValue,
                         int from,
                         int to)

getPoint

public static java.awt.Point getPoint(double currentValue,
                                      java.awt.Point ptFrom,
                                      java.awt.Point ptTo)

getRectangle

public static java.awt.Rectangle getRectangle(double currentValue,
                                              java.awt.Rectangle rcFrom,
                                              java.awt.Rectangle rcTo)

animate

public static void animate(int stepTime,
                           long maxTime,
                           java.beans.PropertyChangeListener listener)
Parameters:
stepTime - The time in ms between each step.
maxTime - The maximum time (in ms) allowed for the animation. If the method predicts that the total time of the animation will be more than maxTime, it will skip enough steps to accomodate the remaining time.
listener - The listener to callback to render each step.
See Also:
animate(int, long, int, double, double, java.beans.PropertyChangeListener)

animate

public static void animate(int stepTime,
                           long maxTime,
                           int steps,
                           double center,
                           double sigma,
                           java.beans.PropertyChangeListener listener)
Calculates transitions values between 0.0 and 1.0 and invokes the listener with each transition value.
The number of transitions is controlled by the steps parameter.
The acceleration and deceleration are controlled by the center and sigma parameters.
The animation rendering is usually too fast on an average computer and must be slowed down. The pause between steps is controlled by stepTime.
maxTime controls the maximum time taken to render the animation. Based on the time taken by each step, the method can predict if we are running late and it will skip steps to speed up the animation. The last step however is never skipped.
Parameters:
stepTime - The time (in ms) to wait between each step.
maxTime - The maximum time (in ms) allowed for the animation.
steps - The number of steps to be used to render the animation.
center - This value balances acceleration vs deceleration. The suggested value for a good effect is 0.6
sigma - Controls the length of the acceleration and deceleration.The suggested value for a good effect is 0.14
listener - The listener to callback to render each step.

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


Copyright © 1997, 2012, Oracle. All rights reserved.