diff --git a/src/java/com/threerings/media/sprite/ImageSprite.java b/src/java/com/threerings/media/sprite/ImageSprite.java index 12ccf1804..c0f8579d7 100644 --- a/src/java/com/threerings/media/sprite/ImageSprite.java +++ b/src/java/com/threerings/media/sprite/ImageSprite.java @@ -1,5 +1,5 @@ // -// $Id: ImageSprite.java,v 1.10 2002/07/08 21:15:35 mdb Exp $ +// $Id: ImageSprite.java,v 1.11 2002/09/17 02:34:05 ray Exp $ package com.threerings.media.sprite; @@ -38,6 +38,11 @@ public class ImageSprite extends Sprite /** Animation mode indicating time based animation. */ public static final int TIME_BASED = 2; + /** Animation mode indicating sequential progressive animation. + * Frame 0 is guaranteed to be shown first for the full duration, and + * so on. */ + public static final int TIME_SEQUENTIAL = 3; + /** * Constructs an image sprite without any associated frames and with * an invalid default initial location. The sprite should be populated @@ -221,7 +226,7 @@ public class ImageSprite extends Sprite if (_frames == null) { return; } - + int fcount = _frames.getFrameCount(); boolean moved = false; @@ -241,6 +246,13 @@ public class ImageSprite extends Sprite nfidx = (int)((timestamp/_frameDelay) % fcount); break; + case TIME_SEQUENTIAL: + if (_firstStamp == 0L) { + _firstStamp = timestamp; + } + nfidx = (int) (((timestamp - _firstStamp) / _frameDelay) % fcount); + break; + case MOVEMENT_CUED: // update the frame if the sprite moved if (moved) { @@ -273,6 +285,9 @@ public class ImageSprite extends Sprite /** For how many milliseconds to display an animation frame. */ protected long _frameDelay; + /** The first timestamp seen (in TIME_SEQUENTIAL mode). */ + protected long _firstStamp = 0L; + // /** DEBUG: The alpha level used when rendering our bounds. */ // protected static final Composite ALPHA_BOUNDS = // AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.2f);