Package: com.multiversesocial.hyperview
Class: com.multiversesocial.hyperview.AnimGob
Source: src/com/multiversesocial/hyperview/AnimGob.java
========== Core Animation Fields ========== ========== Animation Control Fields ========== ========== Frame Range Fields ==========
public class AnimGob extends Gob implements AnimationConstants, HyperConstants
| Declaration | Value / initializer | Description | Source |
|---|---|---|---|
public static final int ANIM_HORIZONTAL_FLIP | = 65536 | ========== Animation Flags (to add to HyperConstants) ========== | |
public static final int ANIM_PING_PONG | = 524288 | No comment in source; used in AnimGob(), setPingPongMode(). | |
public static final int ANIM_REVERSE | = 1048576 | No comment in source; used in AnimGob(). | |
public static final int ANIM_TINT_ENABLED | = 262144 | No comment in source; used in setTint(), clearTint(). | |
public static final int ANIM_VERTICAL_FLIP | = 131072 | No comment in source; used in setVerticalFlip(). | |
int animationFlags | = 0 | ========== Core Animation Fields ========== | |
Graphics bltGraphics | = null | No comment in source; assigned in AnimGob(), cleanUp(). | |
Image bltImage | = null | No comment in source; assigned in AnimGob(), cleanUp(); used in getCurrentFrameImage(). | |
private boolean[] clipOutDone | No comment in source. | ||
private boolean clipOutSrcSet | No comment in source. | ||
private Image clipOutSrc | No comment in source. | ||
private int[][] clipOutX | the traced polygon of every clip (a spinning asteroid's silhouette changes from clip to clip); traced the first time the clip is the current one, from that clip's pixels only. A new strip image drops them all. | ||
private int[][] clipOutY | No comment in source. | ||
int clipWidth | = 0 | No comment in source; assigned in AnimGob(); used in getCurrentFrameImage(), getFramePixels(). | |
AnimGob collisionSequence | = null | No comment in source; assigned in setCollisionAnim(), cleanUp(); used in getCollisionAnim(), hasCollisionAnim(). | |
int curClip | = -1 | No comment in source; assigned in AnimGob(), restart(), gotoFrame(), nextFrame(), prevFrame() …; used in getCurrentFrame(), getProgress(), fireBounce(), getCurrentFrameImage(), onFrameChange() …. | |
private int endFrame | = -1 | No comment in source; assigned in AnimGob(), setFrameRange(), resetFrameRange(); used in restart(), gotoFrame(), nextFrame(), prevFrame(), getEndFrame() …. | |
String fileExtension | = "" | No comment in source; assigned in AnimGob(). | |
private int frameCounter | = 0 | Current frame count (for loop counting) | |
private int frameDelay | = 100 | Milliseconds per frame (default 100ms = 10 FPS) | |
private AnimGob.AnimFrameListener frameListener | = null | ========== Frame Callbacks ========== | |
private boolean goingForward | = true | No comment in source; assigned in restart(), nextFrame(). | |
private boolean horizontalFlip | = false | ========== Flip/Mirror Fields ========== | |
private long lastFrameTime | = 0 | Last frame update time | |
private int lastReportedFrame | = -1 | No comment in source; assigned in onFrameChange(). | |
private int loopCount | = 0 | Number of complete loops | |
private boolean loop | = true | Should loop | |
public volatile boolean manualClip | = false | true: the display does NOT advance curClip any more; the program sets it (gotoFrame / setClip). Used by the Asteroids demo: the ship's clip is its heading, an asteroid's clip follows its own spin rate. | |
private boolean pingPongMode | = false | ========== Ping Pong Mode ========== | |
private int playDirection | = 1 | No comment in source; assigned in AnimGob(), setPlayDirection(), reverse(); used in restart(), getPlayDirection(), nextFrame(), prevFrame(). | |
private boolean playing | = true | Is animation playing | |
private int startFrame | = 0 | ========== Frame Range Fields ========== | |
private Color tintColor | = null | ========== Tint/Color Fields ========== | |
private float tintIntensity | = 0.5F | No comment in source; assigned in setTint(); used in getTintIntensity(). | |
int tint | = 0 | No comment in source; not referenced by name in this type’s methods. | |
int totalClips | = 0 | No comment in source; assigned in AnimGob(); used in setFrameRange(), resetFrameRange(), getTotalFrames(), toString(). | |
int totalHeight | = 1 | No comment in source; assigned in AnimGob(). | |
int totalWidth | = 1 | No comment in source; assigned in AnimGob(). | |
private boolean verticalFlip | = false | No comment in source; assigned in setVerticalFlip(); used in isVerticalFlipped(), toggleVerticalFlip(). |
| Signature | Description | Source |
|---|---|---|
public AnimGob() | 1 statement(s); calls super(). | |
public AnimGob(HyperView tView, Image tStrip, String tName, int pX, int pY, int sourceWidth, int sourceHeight, int numberOfClips) | An AnimGob whose sprite strip is an Image made in code (no file): numberOfClips frames of sourceWidth/numberOfClips x sourceHeight side by side. Adds itself to the view’s Gob list like the other constructors. Used by CollisionAnimGob. | |
public AnimGob(HyperView tView, String tName, String tFileExtension, int pX, int pY, int sourceWidth, int sourceHeight, int numberOfClips) | 1 statement(s); calls this(). | |
public AnimGob(HyperView tView, String tName, String tFileExtension, int pX, int pY, int sourceWidth, int sourceHeight, int numberOfClips, Spline tSpline, int tFlags) | 2 statement(s); calls this(), addSpline(). | |
public AnimGob(HyperView tView, String tName, String tFileExtension, int pX, int pY, int sourceWidth, int sourceHeight, int numberOfClips, int tFlags) | 27 statement(s); calls super(), curView.statusText(), curView.createImage(), bltImage.getGraphics(), curView.getImageFromJar() …; creates IllegalArgumentException. | |
public AnimGob(HyperView tView, String tName, int pX, int pY, int sourceWidth, int sourceHeight, int numberOfClips) | 1 statement(s); calls this(). | |
public AnimGob(HyperView tView, String tName, int pX, int pY, int sourceWidth, int sourceHeight, int numberOfClips, int tFlags) | 1 statement(s); calls this(). |
| Signature | Description | Source |
|---|---|---|
public void cleanUp() | 6 statement(s); calls super.cleanUp(), bltImage.flush(), bltGraphics.dispose(). | |
public void clearTint() | 2 statement(s). | |
public static AnimGob createFromSpriteSheet(HyperView tView, String sheetName, String extension, int frameWidth, int frameHeight, int cols, int rows, int pX, int pY, int fps) | 11 statement(s); calls anim.setFPS(); creates AnimGob. | |
public static AnimGob createFromSpriteSheet(HyperView tView, String sheetName, int frameWidth, int frameHeight, int cols, int rows, int pX, int pY, int fps) | 11 statement(s); calls anim.setFPS(); creates AnimGob. | |
boolean ensureCollisionOutline() | No comment in source. | |
protected void fireAnimationComplete() | 1 statement(s); calls frameListener.onAnimationComplete(). | |
protected void fireAnimationStarted() | 1 statement(s); calls frameListener.onAnimationStarted(). | |
protected void fireAnimationStopped() | 1 statement(s); calls frameListener.onAnimationStopped(). | |
protected void fireBounce() | Called when ping pong mode hits an edge | |
protected void fireFrameChanged(int oldFrame, int newFrame) | 1 statement(s); calls frameListener.onFrameChanged(). | |
protected void fireLoopComplete() | 1 statement(s); calls frameListener.onLoopComplete(). | |
public AnimGob getCollisionAnim() | Returns collisionSequence. | |
public Image getCurrentFrameImage() | 3 statement(s); calls curView.createImage(), getFramePixels(); creates java.awt.image.MemoryImageSource. | |
public int getCurrentFrame() | Returns curClip. | |
public int getEndFrame() | Returns endFrame. | |
public int getFPS() | 2 statement(s). | |
public int getFrameDelay() | Returns frameDelay. | |
private int[] getFramePixels(int xOffset) | This would extract pixels from the sprite sheet For now, return empty array | |
public int getLoopCount() | Returns loopCount. | |
public int getPlayDirection() | Returns playDirection. | |
public float getProgress() | 3 statement(s). | |
public int getStartFrame() | Returns startFrame. | |
public Color getTintColor() | Returns tintColor. | |
public float getTintIntensity() | Returns tintIntensity. | |
public int getTotalFrames() | Returns totalClips. | |
public void gotoFrame(int frame) | 3 statement(s); calls Math.max(), Math.min(), onFrameChange(), fireFrameChanged(). | |
public boolean hasCollisionAnim() | Returns collisionSequence != null. | |
public boolean isHorizontalFlipped() | Returns horizontalFlip. | |
public boolean isLooping() | Returns loop. | |
public boolean isPingPongMode() | Returns pingPongMode. | |
public boolean isPlaying() | Returns playing. | |
public boolean isVerticalFlipped() | Returns verticalFlip. | |
public void nextFrame() | 3 statement(s); calls fireBounce(), fireLoopComplete(), stop(), fireAnimationComplete(), onFrameChange() …. | |
public void onFrameChange() | Default: notify registered frame listener | |
Image outlineImage() | No comment in source. | |
public void pause() | Sets playing = false. | |
public void prevFrame() | 3 statement(s); calls onFrameChange(), fireFrameChanged(). | |
public void removeFrameListener() | Sets this.frameListener = null. | |
public void resetFrameRange() | 2 statement(s). | |
public void restart() | 7 statement(s); calls System.currentTimeMillis(), fireFrameChanged(). | |
public void resume() | 2 statement(s); calls System.currentTimeMillis(). | |
public void reverse() | Sets playDirection = -playDirection. | |
public void setClip(int k) | Show clip k (0 .. totalClips-1) at the next display frame; takes the clip out of the display's auto advance. | |
public boolean setCollisionAnim(AnimGob anm) | 2 statement(s). | |
public void setFPS(int framesPerSecond) | 1 statement(s). | |
public void setFrameDelay(int milliseconds) | Sets this.frameDelay = Math.max(1, milliseconds). | |
public void setFrameListener(AnimGob.AnimFrameListener listener) | Sets this.frameListener = listener. | |
public void setFrameRange(int start, int end) | 4 statement(s); calls Math.max(), Math.min(). | |
public void setHorizontalFlip(boolean flip) | 2 statement(s). | |
public void setLoop(boolean shouldLoop) | Sets this.loop = shouldLoop. | |
public void setPingPongMode(boolean enable) | 2 statement(s). | |
public void setPlayDirection(int direction) | Sets this.playDirection = (direction >= 0) ? 1 : -1. | |
public void setSpeed(float speedFactor) | 2 statement(s); calls getFPS(). | |
public void setTint(Color tintColor) | 2 statement(s). | |
public void setTint(Color tintColor, float intensity) | 3 statement(s); calls Math.max(), Math.min(). | |
public void setVerticalFlip(boolean flip) | 2 statement(s). | |
public void slowDown(float factor) | 1 statement(s). | |
public void speedUp(float factor) | 1 statement(s). | |
int[] spriteRect() | V3.23: the clip being shown (picking by alpha, rotated drawing) | |
public void start() | 1 statement(s); calls System.currentTimeMillis(), fireAnimationStarted(). | |
public void stop() | 1 statement(s); calls fireAnimationStopped(). | |
public void toggleHorizontalFlip() | 1 statement(s); calls setHorizontalFlip(). | |
public void toggleVerticalFlip() | 1 statement(s); calls setVerticalFlip(). | |
public String toString() | Returns "AnimGob[" + gobName + ", frame=" + curClip + "/" + totalClips + ", playing=" + playing + ", fps=" +. | |
public int tracedClipOutlines() | Number of clips whose outline has been traced so far (a test reads it). | |
public void updateAnimation() | 3 statement(s); calls System.currentTimeMillis(), nextFrame(). |
public abstract static interface AnimFrameListener
| Signature | Description | Source |
|---|---|---|
public abstract void onAnimationComplete(AnimGob source) | Interface method (no body); implemented by classes that implement this interface. | |
public abstract void onAnimationStarted(AnimGob source) | Interface method (no body); implemented by classes that implement this interface. | |
public abstract void onAnimationStopped(AnimGob source) | Interface method (no body); implemented by classes that implement this interface. | |
public abstract void onFrameChanged(AnimGob source, int oldFrame, int newFrame) | Interface method (no body); implemented by classes that implement this interface. | |
public abstract void onLoopComplete(AnimGob source, int loopCount) | Interface method (no body); implemented by classes that implement this interface. |
Fields: asynchGraphics1, asynchGraphics2, asynchImage1, asynchImage2, attachedGob, attachedIndex, backGround, bgMemoryImageSource, bGPen, bottomMax, clickX, clickY, collisionClassMask, curAttached, currentZIndex, curView, depth, destGob, destGraphics, dispatchHoldCount, drawMode, dX, dY, dZ, fgMemoryImageSource, fGPen, gobEventFlags, gobFlags, gobFlags2, gobGadIndex, gobHx, gobHy, gobHz, gobName, gobNumber, gobOrbitRadius, gobPic, gobTypeFlags, graphics, gravity, height, heightBase, hSin, hyp, infoString, lClickX, lClickY, leftMin, maxAttached, memoryCounter, moveNum, mX, mX2, mY, mY2, oldX, oldY, oldZ, orbitGob, rightMax, scanLine, selectGraphics, selectImage, selectTime, spline, topMin, totalAttached, width, widthBase, wSin, x, x2, y, y2, z
Methods: addGob(Gob), addSpline(Spline), center(), collisionOff(), collisionOn(), disable(), enable(), getGraphics(), getImageFromJar(String), getPixels(), gobZInit(), initScanline(int), inView(), isInView(), isMemoryImageSource(), move(int, int), move(Gadget, int, int), moveNext(), onClick(), onDisplay(), onRelease(), printGobAttr(HyperView), printScanLines(), remGob(), remove(), zENA(), zOff()
Fields: attachment, index, linkFlags, name, next, parentList, prev
Methods: inList(), setName(String)
instantiation — ViewMain.java, line 155
155 AnimGob agb3 = new AnimGob(this,"world_anim",".gif",200,150,3300,100,33,spline3,0);
declaration — HyperView.java, line 123
123 volatile AnimGob tmpAnimGob;