Whitespace
git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@889 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -64,7 +64,7 @@ public class AnimationSequencer extends Animation
|
|||||||
* immediately when this "animation" is ready to fired.
|
* immediately when this "animation" is ready to fired.
|
||||||
* @param delta the number of milliseconds following the <em>start</em> of the previous
|
* @param delta the number of milliseconds following the <em>start</em> of the previous
|
||||||
* animation in the queue that this animation should be started; 0 if it should be started
|
* animation in the queue that this animation should be started; 0 if it should be started
|
||||||
* simultaneously with its predecessor int the queue; -1 if it should be started when its
|
* simultaneously with its predecessor in the queue; -1 if it should be started when its
|
||||||
* predecessor has completed.
|
* predecessor has completed.
|
||||||
* @param completionAction a runnable to be executed when this animation completes.
|
* @param completionAction a runnable to be executed when this animation completes.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -37,24 +37,22 @@ import com.threerings.media.util.TimeFunction;
|
|||||||
public class ScaleAnimation extends Animation
|
public class ScaleAnimation extends Animation
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Creates a scale animation with the supplied image. If the image's
|
* Creates a scale animation with the supplied image. If the image's size would ever be 0 or
|
||||||
* size would ever be 0 or less, it is not drawn.
|
* less, it is not drawn.
|
||||||
*
|
*
|
||||||
* @param image The image to paint.
|
* @param image The image to paint.
|
||||||
*
|
*
|
||||||
* @param center The screen coordinates of the pixel upon which the
|
* @param center The screen coordinates of the pixel upon which the image's center should
|
||||||
* image's center should always be rendered.
|
* always be rendered.
|
||||||
*
|
*
|
||||||
* @param startScale The amount to scale the image when it is rendered
|
* @param startScale The amount to scale the image when it is rendered at time 0.
|
||||||
* at time 0.
|
|
||||||
*
|
*
|
||||||
* @param endScale The amount to scale the image at the final frame
|
* @param endScale The amount to scale the image at the final frame of animation.
|
||||||
* of animation.
|
|
||||||
*
|
*
|
||||||
* @param duration The time in milliseconds the anim takes to complete.
|
* @param duration The time in milliseconds the anim takes to complete.
|
||||||
*/
|
*/
|
||||||
public ScaleAnimation (Mirage image, Point center,
|
public ScaleAnimation (
|
||||||
float startScale, float endScale, int duration)
|
Mirage image, Point center, float startScale, float endScale, int duration)
|
||||||
{
|
{
|
||||||
super(getBounds(Math.max(startScale, endScale), center, image));
|
super(getBounds(Math.max(startScale, endScale), center, image));
|
||||||
|
|
||||||
@@ -68,22 +66,19 @@ public class ScaleAnimation extends Animation
|
|||||||
|
|
||||||
// Hack the LinearTimeFunction to use fixed point rationals
|
// Hack the LinearTimeFunction to use fixed point rationals
|
||||||
//
|
//
|
||||||
// FIXME: This class doesn't seem to be saving me a lot of
|
// FIXME: This class doesn't seem to be saving me a lot of work, since I have to repackage
|
||||||
// work, since I have to repackage the outputs into floats
|
// the outputs into floats anyway. Find some way to make the LinearTimeFunction do more of
|
||||||
// anyway. Find some way to make the LinearTimeFunction do
|
// this work for us, or write a new class that does. Maybe IntLinearTimeFunction and
|
||||||
// more of this work for us, or write a new class that does.
|
// FloatLinearTimeFunction classes would be useful.
|
||||||
// Maybe IntLinearTimeFunction and FloatLinearTimeFunction
|
|
||||||
// classes would be useful.
|
|
||||||
_scaleFunc = new LinearTimeFunction(0, 10000, duration);
|
_scaleFunc = new LinearTimeFunction(0, 10000, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Java wants the first call in a constructor to be super()
|
* Java wants the first call in a constructor to be super() if it exists at all, so we have to
|
||||||
* if it exists at all, so we have to trick it with this function.
|
* trick it with this function.
|
||||||
*
|
*
|
||||||
* Oh, and this function computes how big the bounding box needs
|
* Oh, and this function computes how big the bounding box needs to be to bound the inputted
|
||||||
* to be to bound the inputted image scaled to the inputted size
|
* image scaled to the inputted size centered around the inputted center poitn.
|
||||||
* centered around the inputted center poitn.
|
|
||||||
*/
|
*/
|
||||||
public static Rectangle getBounds (float scale, Point center, Mirage image)
|
public static Rectangle getBounds (float scale, Point center, Mirage image)
|
||||||
{
|
{
|
||||||
@@ -107,8 +102,8 @@ public class ScaleAnimation extends Animation
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Computes the upper left corner where the image should be drawn,
|
* Computes the upper left corner where the image should be drawn, given the center and
|
||||||
* given the center and dimensions to which the image should be scaled.
|
* dimensions to which the image should be scaled.
|
||||||
*/
|
*/
|
||||||
public static Point getCorner (Point center, Point size)
|
public static Point getCorner (Point center, Point size)
|
||||||
{
|
{
|
||||||
@@ -124,8 +119,7 @@ public class ScaleAnimation extends Animation
|
|||||||
(( weight) * _endScale);
|
(( weight) * _endScale);
|
||||||
|
|
||||||
// Update the animation if the scaling changes
|
// Update the animation if the scaling changes
|
||||||
if (_scale != scale)
|
if (_scale != scale) {
|
||||||
{
|
|
||||||
_scale = scale;
|
_scale = scale;
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user