Package ca.cgjennings.ui.anim
Class AnimationUtilities
- java.lang.Object
-
- ca.cgjennings.ui.anim.AnimationUtilities
-
public class AnimationUtilities extends java.lang.ObjectHelper methods for working with animations.- Author:
- Chris Jennings
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidanimateIconTransition(javax.swing.JButton target, javax.swing.Icon newIcon)Performs a subtle animated transition between the icon currently set on target and a new icon.static voidanimateIconTransition(javax.swing.JLabel target, javax.swing.Icon newIcon)Performs a subtle animated transition between the icon currently set on target and a new icon.static voidanimateOpacityTransition(java.awt.Window w, float startAlpha, float endAlpha, float seconds, boolean disposeOnFinish)Animates a change in the opacity of a window, if opacity changes are supported and enabled.static voidattentionFlash(javax.swing.JComponent target, java.awt.Color flashColor)Calls attention to a component by flashing its background.static FrameComposercut(FrameComposer original, float start, float end)Given a composition, return a new composition that plays a subsequence of the original.static FrameComposerloop(FrameComposer forward)Given a composition, return a new composition that can play the original composition in a loop by playing it forwards, then backwards.static FrameComposerreverse(FrameComposer forward)Given a composition, return a new composition that plays the original composition in reverse.
-
-
-
Method Detail
-
reverse
public static FrameComposer reverse(FrameComposer forward)
Given a composition, return a new composition that plays the original composition in reverse.- Parameters:
forward- the forward-playing composition- Returns:
- a composer that wraps the original composer
-
loop
public static FrameComposer loop(FrameComposer forward)
Given a composition, return a new composition that can play the original composition in a loop by playing it forwards, then backwards.- Parameters:
forward- the forward-playing composition- Returns:
- a composer that wraps the original composer
-
cut
public static FrameComposer cut(FrameComposer original, float start, float end)
Given a composition, return a new composition that plays a subsequence of the original.- Parameters:
original- the composition to cutstart- the time point to start the cut atend- the time point to end the cut at- Returns:
- a composer that wraps the original composer
-
animateIconTransition
public static void animateIconTransition(javax.swing.JLabel target, javax.swing.Icon newIcon)Performs a subtle animated transition between the icon currently set on target and a new icon.- Parameters:
target- the label whose icon will changenewIcon- the new icon for the label
-
animateIconTransition
public static void animateIconTransition(javax.swing.JButton target, javax.swing.Icon newIcon)Performs a subtle animated transition between the icon currently set on target and a new icon.- Parameters:
target- the label whose icon will changenewIcon- the new icon for the label
-
animateOpacityTransition
public static void animateOpacityTransition(java.awt.Window w, float startAlpha, float endAlpha, float seconds, boolean disposeOnFinish)Animates a change in the opacity of a window, if opacity changes are supported and enabled.- Parameters:
w- the window to animatestartAlpha- the starting alpha value for the window; if -1, the window's current alpha is usedendAlpha- the alpha value for the window at the end of animationseconds- the duration of the animationdisposeOnFinish- iftrue, the window'sdisposemethod is called when the animation completes- Throws:
java.lang.NullPointerException- if the windowwis nulljava.lang.IllegalArgumentException- if the alpha values are outside of the 0 to 1 range (except thatstartAlphamay be -1) or ifsecondsis negative
-
attentionFlash
public static void attentionFlash(javax.swing.JComponent target, java.awt.Color flashColor)Calls attention to a component by flashing its background.- Parameters:
target- the component to flashflashColor- the background colour to use when flashing; ifnulla default colour is used
-
-