Whitespace
git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@880 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -36,9 +36,8 @@ import com.threerings.media.util.TimeFunction;
|
|||||||
public class BlendAnimation extends Animation
|
public class BlendAnimation extends Animation
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Blends from the starting image through each successive image in the
|
* Blends from the starting image through each successive image in the specified amount of
|
||||||
* specified amount of time (blending between each image takes place
|
* time (blending between each image takes place in <code>delay</code> milliseconds).
|
||||||
* in <code>delay</code> milliseconds).
|
|
||||||
*/
|
*/
|
||||||
public BlendAnimation (int x, int y, Mirage[] images, int delay)
|
public BlendAnimation (int x, int y, Mirage[] images, int delay)
|
||||||
{
|
{
|
||||||
@@ -77,12 +76,10 @@ public class BlendAnimation extends Animation
|
|||||||
float alpha = 1f - (_level % 100) / 100f;
|
float alpha = 1f - (_level % 100) / 100f;
|
||||||
|
|
||||||
Composite ocomp = gfx.getComposite();
|
Composite ocomp = gfx.getComposite();
|
||||||
gfx.setComposite(AlphaComposite.getInstance(
|
gfx.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha));
|
||||||
AlphaComposite.SRC_OVER, alpha));
|
|
||||||
_images[index].paint(gfx, _bounds.x, _bounds.y);
|
_images[index].paint(gfx, _bounds.x, _bounds.y);
|
||||||
if (index < _images.length-1) {
|
if (index < _images.length-1) {
|
||||||
gfx.setComposite(AlphaComposite.getInstance(
|
gfx.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f-alpha));
|
||||||
AlphaComposite.SRC_OVER, 1f-alpha));
|
|
||||||
_images[index+1].paint(gfx, _bounds.x, _bounds.y);
|
_images[index+1].paint(gfx, _bounds.x, _bounds.y);
|
||||||
}
|
}
|
||||||
gfx.setComposite(ocomp);
|
gfx.setComposite(ocomp);
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ import com.samskivert.util.RandomUtil;
|
|||||||
import com.threerings.media.image.Mirage;
|
import com.threerings.media.image.Mirage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An animation that bobbles an image around within a specific horizontal
|
* An animation that bobbles an image around within a specific horizontal and vertical pixel range
|
||||||
* and vertical pixel range for a given period of time.
|
* for a given period of time.
|
||||||
*/
|
*/
|
||||||
public class BobbleAnimation extends Animation
|
public class BobbleAnimation extends Animation
|
||||||
{
|
{
|
||||||
@@ -44,11 +44,9 @@ public class BobbleAnimation extends Animation
|
|||||||
* @param ry the vertical bobble range.
|
* @param ry the vertical bobble range.
|
||||||
* @param duration the time to animate in milliseconds.
|
* @param duration the time to animate in milliseconds.
|
||||||
*/
|
*/
|
||||||
public BobbleAnimation (
|
public BobbleAnimation (Mirage image, int sx, int sy, int rx, int ry, int duration)
|
||||||
Mirage image, int sx, int sy, int rx, int ry, int duration)
|
|
||||||
{
|
{
|
||||||
super(new Rectangle(sx - rx, sy - ry, image.getWidth() + rx,
|
super(new Rectangle(sx - rx, sy - ry, image.getWidth() + rx, image.getHeight() + ry));
|
||||||
image.getHeight() + ry));
|
|
||||||
|
|
||||||
// save things off
|
// save things off
|
||||||
_image = image;
|
_image = image;
|
||||||
|
|||||||
@@ -34,10 +34,9 @@ import com.samskivert.util.StringUtil;
|
|||||||
import com.threerings.media.image.Mirage;
|
import com.threerings.media.image.Mirage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An animation that displays an object exploding into chunks, fading out
|
* An animation that displays an object exploding into chunks, fading out as they fly apart. The
|
||||||
* as they fly apart. The animation ends when all chunks have exited the
|
* animation ends when all chunks have exited the animation bounds, or when the given delay time
|
||||||
* animation bounds, or when the given delay time (if any is specified)
|
* (if any is specified) has elapsed.
|
||||||
* has elapsed.
|
|
||||||
*/
|
*/
|
||||||
public class ExplodeAnimation extends Animation
|
public class ExplodeAnimation extends Animation
|
||||||
{
|
{
|
||||||
@@ -52,8 +51,7 @@ public class ExplodeAnimation extends Animation
|
|||||||
/** The number of image chunks on each axis. */
|
/** The number of image chunks on each axis. */
|
||||||
public int xchunk, ychunk;
|
public int xchunk, ychunk;
|
||||||
|
|
||||||
/** The maximum chunk velocity on each axis in pixels per
|
/** The maximum chunk velocity on each axis in pixels per millisecond. */
|
||||||
* millisecond. */
|
|
||||||
public float xvel, yvel;
|
public float xvel, yvel;
|
||||||
|
|
||||||
/** The y-axis chunk acceleration in pixels per millisecond. */
|
/** The y-axis chunk acceleration in pixels per millisecond. */
|
||||||
@@ -62,8 +60,8 @@ public class ExplodeAnimation extends Animation
|
|||||||
/** The chunk rotational velocity in rotations per millisecond. */
|
/** The chunk rotational velocity in rotations per millisecond. */
|
||||||
public float rvel;
|
public float rvel;
|
||||||
|
|
||||||
/** The animation length in milliseconds, or -1 if the animation
|
/** The animation length in milliseconds, or -1 if the animation should continue until
|
||||||
* should continue until all pieces are outside the bounds. */
|
* all pieces are outside the bounds. */
|
||||||
public long delay;
|
public long delay;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -74,8 +72,8 @@ public class ExplodeAnimation extends Animation
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an explode animation with the chunks represented as
|
* Constructs an explode animation with the chunks represented as filled rectangles of the
|
||||||
* filled rectangles of the specified color.
|
* specified color.
|
||||||
*
|
*
|
||||||
* @param color the color to render the chunks in.
|
* @param color the color to render the chunks in.
|
||||||
* @param info the explode info object.
|
* @param info the explode info object.
|
||||||
@@ -84,8 +82,7 @@ public class ExplodeAnimation extends Animation
|
|||||||
* @param width the width of the object.
|
* @param width the width of the object.
|
||||||
* @param height the height of the object.
|
* @param height the height of the object.
|
||||||
*/
|
*/
|
||||||
public ExplodeAnimation (
|
public ExplodeAnimation (Color color, ExplodeInfo info, int x, int y, int width, int height)
|
||||||
Color color, ExplodeInfo info, int x, int y, int width, int height)
|
|
||||||
{
|
{
|
||||||
super(info.bounds);
|
super(info.bounds);
|
||||||
|
|
||||||
@@ -94,8 +91,8 @@ public class ExplodeAnimation extends Animation
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an explode animation with the chunks represented as
|
* Constructs an explode animation with the chunks represented as portions of the actual
|
||||||
* portions of the actual image.
|
* image.
|
||||||
*
|
*
|
||||||
* @param image the image to animate.
|
* @param image the image to animate.
|
||||||
* @param info the explode info object.
|
* @param info the explode info object.
|
||||||
@@ -104,8 +101,7 @@ public class ExplodeAnimation extends Animation
|
|||||||
* @param width the width of the object.
|
* @param width the width of the object.
|
||||||
* @param height the height of the object.
|
* @param height the height of the object.
|
||||||
*/
|
*/
|
||||||
public ExplodeAnimation (
|
public ExplodeAnimation (Mirage image, ExplodeInfo info, int x, int y, int width, int height)
|
||||||
Mirage image, ExplodeInfo info, int x, int y, int width, int height)
|
|
||||||
{
|
{
|
||||||
super(info.bounds);
|
super(info.bounds);
|
||||||
|
|
||||||
@@ -114,8 +110,7 @@ public class ExplodeAnimation extends Animation
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the animation with the attributes of the given explode
|
* Initializes the animation with the attributes of the given explode info object.
|
||||||
* info object.
|
|
||||||
*/
|
*/
|
||||||
protected void init (ExplodeInfo info, int x, int y, int width, int height)
|
protected void init (ExplodeInfo info, int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
@@ -227,8 +222,7 @@ public class ExplodeAnimation extends Animation
|
|||||||
if (_info.delay != -1) {
|
if (_info.delay != -1) {
|
||||||
// set the alpha composite to reflect the current fade-out
|
// set the alpha composite to reflect the current fade-out
|
||||||
ocomp = gfx.getComposite();
|
ocomp = gfx.getComposite();
|
||||||
gfx.setComposite(
|
gfx.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, _alpha));
|
||||||
AlphaComposite.getInstance(AlphaComposite.SRC_OVER, _alpha));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int ii = 0; ii < _chunkcount; ii++) {
|
for (int ii = 0; ii < _chunkcount; ii++) {
|
||||||
@@ -303,8 +297,7 @@ public class ExplodeAnimation extends Animation
|
|||||||
/** The individual chunk dimensions in pixels. */
|
/** The individual chunk dimensions in pixels. */
|
||||||
protected int _cwid, _chei;
|
protected int _cwid, _chei;
|
||||||
|
|
||||||
/** The individual chunk dimensions in pixels, halved for handy use in
|
/** The individual chunk dimensions in pixels, halved for handy use in repeated calculations. */
|
||||||
* repeated calculations. */
|
|
||||||
protected int _hcwid, _hchei;
|
protected int _hcwid, _hchei;
|
||||||
|
|
||||||
/** The total number of image chunks. */
|
/** The total number of image chunks. */
|
||||||
|
|||||||
@@ -34,11 +34,9 @@ public class FadeImageAnimation extends FadeAnimation
|
|||||||
/**
|
/**
|
||||||
* Creates an image fading animation.
|
* Creates an image fading animation.
|
||||||
*/
|
*/
|
||||||
public FadeImageAnimation (Mirage image, int x, int y,
|
public FadeImageAnimation (Mirage image, int x, int y, float alpha, float step, float target)
|
||||||
float alpha, float step, float target)
|
|
||||||
{
|
{
|
||||||
super(new Rectangle(x, y, image.getWidth(), image.getHeight()),
|
super(new Rectangle(x, y, image.getWidth(), image.getHeight()), alpha, step, target);
|
||||||
alpha, step, target);
|
|
||||||
_image = image;
|
_image = image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,8 +37,7 @@ public class FadeLabelAnimation extends FadeAnimation
|
|||||||
/**
|
/**
|
||||||
* Creates a label fading animation.
|
* Creates a label fading animation.
|
||||||
*/
|
*/
|
||||||
public FadeLabelAnimation (Label label, int x, int y,
|
public FadeLabelAnimation (Label label, int x, int y, float alpha, float step, float target)
|
||||||
float alpha, float step, float target)
|
|
||||||
{
|
{
|
||||||
super(new Rectangle(x, y, 0, 0), alpha, step, target);
|
super(new Rectangle(x, y, 0, 0), alpha, step, target);
|
||||||
_label = label;
|
_label = label;
|
||||||
|
|||||||
@@ -31,8 +31,7 @@ import com.samskivert.swing.Label;
|
|||||||
public class FloatingTextAnimation extends Animation
|
public class FloatingTextAnimation extends Animation
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Constructs an animation for the given text centered at the given
|
* Constructs an animation for the given text centered at the given coordinates.
|
||||||
* coordinates.
|
|
||||||
*/
|
*/
|
||||||
public FloatingTextAnimation (Label label, int x, int y)
|
public FloatingTextAnimation (Label label, int x, int y)
|
||||||
{
|
{
|
||||||
@@ -40,8 +39,8 @@ public class FloatingTextAnimation extends Animation
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an animation for the given text centered at the given
|
* Constructs an animation for the given text centered at the given coordinates. The animation
|
||||||
* coordinates. The animation will float up the screen for 30 pixels.
|
* will float up the screen for 30 pixels.
|
||||||
*/
|
*/
|
||||||
public FloatingTextAnimation (Label label, int x, int y, long floatPeriod)
|
public FloatingTextAnimation (Label label, int x, int y, long floatPeriod)
|
||||||
{
|
{
|
||||||
@@ -49,14 +48,13 @@ public class FloatingTextAnimation extends Animation
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an animation for the given text starting at the given
|
* Constructs an animation for the given text starting at the given coordinates and floating
|
||||||
* coordinates and floating toward the specified coordinates.
|
* toward the specified coordinates.
|
||||||
*/
|
*/
|
||||||
public FloatingTextAnimation (Label label, int sx, int sy,
|
public FloatingTextAnimation (
|
||||||
int destx, int desty, long floatPeriod)
|
Label label, int sx, int sy, int destx, int desty, long floatPeriod)
|
||||||
{
|
{
|
||||||
super(new Rectangle(sx, sy, label.getSize().width,
|
super(new Rectangle(sx, sy, label.getSize().width, label.getSize().height));
|
||||||
label.getSize().height));
|
|
||||||
|
|
||||||
// save things off
|
// save things off
|
||||||
_label = label;
|
_label = label;
|
||||||
@@ -110,9 +108,8 @@ public class FloatingTextAnimation extends Animation
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the duration of this score animation to the specified time in
|
* Sets the duration of this score animation to the specified time in milliseconds. This
|
||||||
* milliseconds. This should be called before the animation is added
|
* should be called before the animation is added to the animation manager.
|
||||||
* to the animation manager.
|
|
||||||
*/
|
*/
|
||||||
public void setFloatPeriod (long floatPeriod)
|
public void setFloatPeriod (long floatPeriod)
|
||||||
{
|
{
|
||||||
@@ -151,8 +148,7 @@ public class FloatingTextAnimation extends Animation
|
|||||||
_x = _startX + (int)(_dx * pctdone);
|
_x = _startX + (int)(_dx * pctdone);
|
||||||
_y = _startY + (int)(_dy * pctdone);
|
_y = _startY + (int)(_dy * pctdone);
|
||||||
|
|
||||||
// only update our location and dirty ourselves if we actually
|
// only update our location and dirty ourselves if we actually moved or our alpha changed
|
||||||
// moved or our alpha changed
|
|
||||||
if (ox != _x || oy != _y) {
|
if (ox != _x || oy != _y) {
|
||||||
// dirty our old location
|
// dirty our old location
|
||||||
invalidate();
|
invalidate();
|
||||||
@@ -192,8 +188,8 @@ public class FloatingTextAnimation extends Animation
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Derived classes may wish to extend score animation and render more than
|
* Derived classes may wish to extend score animation and render more than just the standard
|
||||||
* just the standard single label.
|
* single label.
|
||||||
*
|
*
|
||||||
* @param x the upper left coordinate of the animation.
|
* @param x the upper left coordinate of the animation.
|
||||||
* @param y the upper left coordinate of the animation.
|
* @param y the upper left coordinate of the animation.
|
||||||
|
|||||||
@@ -35,9 +35,8 @@ import com.threerings.media.util.LinearTimeFunction;
|
|||||||
import com.threerings.media.util.TimeFunction;
|
import com.threerings.media.util.TimeFunction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Washes all non-transparent pixels in a sprite with a particular color
|
* Washes all non-transparent pixels in a sprite with a particular color (by compositing them with
|
||||||
* (by compositing them with the solid color with progressively higher
|
* the solid color with progressively higher alpha values) and then back again.
|
||||||
* alpha values) and then back again.
|
|
||||||
*/
|
*/
|
||||||
public class GleamAnimation extends Animation
|
public class GleamAnimation extends Animation
|
||||||
{
|
{
|
||||||
@@ -96,8 +95,7 @@ public class GleamAnimation extends Animation
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the sprite is moved or changed size while we're gleaming it,
|
// if the sprite is moved or changed size while we're gleaming it, track those changes
|
||||||
// track those changes
|
|
||||||
if (!_bounds.equals(_sprite.getBounds())) {
|
if (!_bounds.equals(_sprite.getBounds())) {
|
||||||
Rectangle obounds = new Rectangle(_bounds);
|
Rectangle obounds = new Rectangle(_bounds);
|
||||||
_bounds.setBounds(_sprite.getBounds());
|
_bounds.setBounds(_sprite.getBounds());
|
||||||
@@ -110,7 +108,7 @@ public class GleamAnimation extends Animation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // documentation inherited
|
@Override
|
||||||
public void fastForward (long timeDelta)
|
public void fastForward (long timeDelta)
|
||||||
{
|
{
|
||||||
if (_upfunc != null) {
|
if (_upfunc != null) {
|
||||||
@@ -120,7 +118,7 @@ public class GleamAnimation extends Animation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // documentation inherited
|
@Override
|
||||||
public void paint (Graphics2D gfx)
|
public void paint (Graphics2D gfx)
|
||||||
{
|
{
|
||||||
// TODO: recreate our off image if the sprite bounds changed; we
|
// TODO: recreate our off image if the sprite bounds changed; we
|
||||||
@@ -167,7 +165,7 @@ public class GleamAnimation extends Animation
|
|||||||
gfx.setComposite(ocomp);
|
gfx.setComposite(ocomp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // documentation inherited
|
@Override
|
||||||
protected void willStart (long tickStamp)
|
protected void willStart (long tickStamp)
|
||||||
{
|
{
|
||||||
_upfunc = new LinearTimeFunction(_minAlpha, _maxAlpha, _upmillis);
|
_upfunc = new LinearTimeFunction(_minAlpha, _maxAlpha, _upmillis);
|
||||||
@@ -182,7 +180,7 @@ public class GleamAnimation extends Animation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override //documentation inherited
|
@Override
|
||||||
protected void shutdown ()
|
protected void shutdown ()
|
||||||
{
|
{
|
||||||
super.shutdown();
|
super.shutdown();
|
||||||
|
|||||||
Reference in New Issue
Block a user