Package: com.multiversesocial.hyperview
Class: com.multiversesocial.hyperview.AnimGob
Source: src/com/multiversesocial/hyperview/AnimGob.java

AnimGob

HyperView V3.2 — class
version V3.2 class

Summary

========== Core Animation Fields ========== ========== Animation Control Fields ========== ========== Frame Range Fields ==========

Source file: AnimGob.java

Hierarchy

Extends: Gob

Implements: AnimationConstants, HyperConstants

Referenced HyperView classes

Media files used

Declaration & members

public class AnimGob extends Gob implements AnimationConstants, HyperConstants

Declared in src/com/multiversesocial/hyperview/AnimGob.java, lines 1–845. 39 field(s), 7 constructor(s), 66 method(s), plus 1 nested type(s). Every member has an anchor you can link to (e.g. AnimGob.html#<id>).

Fields (39)

DeclarationValue / initializerDescriptionSource
public static final int ANIM_HORIZONTAL_FLIP= 65536 (constant)========== Animation Flags (to add to HyperConstants) ==========line 51
public static final int ANIM_PING_PONG= 524288 (constant)No comment in source; used in AnimGob(), setPingPongMode().line 54
public static final int ANIM_REVERSE= 1048576 (constant)No comment in source; used in AnimGob().line 55
public static final int ANIM_TINT_ENABLED= 262144 (constant)No comment in source; used in setTint(), clearTint().line 53
public static final int ANIM_VERTICAL_FLIP= 131072 (constant)No comment in source; used in setVerticalFlip().line 52
int animationFlags= 0========== Core Animation Fields ==========line 9
Graphics bltGraphics= nullNo comment in source; assigned in AnimGob(), cleanUp().line 12
Image bltImage= nullNo comment in source; assigned in AnimGob(), cleanUp(); used in getCurrentFrameImage().line 11
private boolean[] clipOutDoneNo comment in source.line 746
private boolean clipOutSrcSetNo comment in source.line 748
private Image clipOutSrcNo comment in source.line 747
private int[][] clipOutXthe 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.line 744
private int[][] clipOutYNo comment in source.line 745
int clipWidth= 0No comment in source; assigned in AnimGob(); used in getCurrentFrameImage(), getFramePixels().line 16
AnimGob collisionSequence= nullNo comment in source; assigned in setCollisionAnim(), cleanUp(); used in getCollisionAnim(), hasCollisionAnim().line 18
int curClip= -1No comment in source; assigned in AnimGob(), restart(), gotoFrame(), nextFrame(), prevFrame() …; used in getCurrentFrame(), getProgress(), fireBounce(), getCurrentFrameImage(), onFrameChange() ….line 13
private int endFrame= -1No comment in source; assigned in AnimGob(), setFrameRange(), resetFrameRange(); used in restart(), gotoFrame(), nextFrame(), prevFrame(), getEndFrame() ….line 32
String fileExtension= ""No comment in source; assigned in AnimGob().line 19
private int frameCounter= 0Current frame count (for loop counting)line 27
private int frameDelay= 100Milliseconds per frame (default 100ms = 10 FPS)line 22
private AnimGob.AnimFrameListener frameListener= null========== Frame Callbacks ==========line 47
private boolean goingForward= trueNo comment in source; assigned in restart(), nextFrame().line 36
private boolean horizontalFlip= false========== Flip/Mirror Fields ==========line 39
private long lastFrameTime= 0Last frame update timeline 23
private int lastReportedFrame= -1No comment in source; assigned in onFrameChange().line 48
private int loopCount= 0Number of complete loopsline 28
private boolean loop= trueShould loopline 25
public volatile boolean manualClip= falsetrue: 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.line 718
private boolean pingPongMode= false========== Ping Pong Mode ==========line 35
private int playDirection= 1No comment in source; assigned in AnimGob(), setPlayDirection(), reverse(); used in restart(), getPlayDirection(), nextFrame(), prevFrame().line 26
private boolean playing= trueIs animation playingline 24
private int startFrame= 0========== Frame Range Fields ==========line 31
private Color tintColor= null========== Tint/Color Fields ==========line 43
private float tintIntensity= 0.5FNo comment in source; assigned in setTint(); used in getTintIntensity().line 44
int tint= 0No comment in source; not referenced by name in this type’s methods.line 10
int totalClips= 0No comment in source; assigned in AnimGob(); used in setFrameRange(), resetFrameRange(), getTotalFrames(), toString().line 14
int totalHeight= 1No comment in source; assigned in AnimGob().line 17
int totalWidth= 1No comment in source; assigned in AnimGob().line 15
private boolean verticalFlip= falseNo comment in source; assigned in setVerticalFlip(); used in isVerticalFlipped(), toggleVerticalFlip().line 40

Constructors (7)

SignatureDescriptionSource
public AnimGob()1 statement(s); calls super().line 69
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.line 178
public AnimGob(HyperView tView, String tName, String tFileExtension, int pX, int pY, int sourceWidth, int sourceHeight, int numberOfClips)1 statement(s); calls this().line 83
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().line 153
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.line 89
public AnimGob(HyperView tView, String tName, int pX, int pY, int sourceWidth, int sourceHeight, int numberOfClips)1 statement(s); calls this().line 73
public AnimGob(HyperView tView, String tName, int pX, int pY, int sourceWidth, int sourceHeight, int numberOfClips, int tFlags)1 statement(s); calls this().line 78

Methods (66)

SignatureDescriptionSource
public void cleanUp()6 statement(s); calls super.cleanUp(), bltImage.flush(), bltGraphics.dispose().
Overrides Gob.cleanUp()
line 819
public void clearTint()2 statement(s).line 539
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.line 643
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.line 623
boolean ensureCollisionOutline()No comment in source.line 761
protected void fireAnimationComplete()1 statement(s); calls frameListener.onAnimationComplete().line 566
protected void fireAnimationStarted()1 statement(s); calls frameListener.onAnimationStarted().line 578
protected void fireAnimationStopped()1 statement(s); calls frameListener.onAnimationStopped().line 584
protected void fireBounce()Called when ping pong mode hits an edgeline 590
protected void fireFrameChanged(int oldFrame, int newFrame)1 statement(s); calls frameListener.onFrameChanged().line 560
protected void fireLoopComplete()1 statement(s); calls frameListener.onLoopComplete().line 572
public AnimGob getCollisionAnim()Returns collisionSequence.line 611
public Image getCurrentFrameImage()3 statement(s); calls curView.createImage(), getFramePixels(); creates java.awt.image.MemoryImageSource.line 685
public int getCurrentFrame()Returns curClip.line 452
public int getEndFrame()Returns endFrame.line 448
public int getFPS()2 statement(s).line 471
public int getFrameDelay()Returns frameDelay.line 259
private int[] getFramePixels(int xOffset)This would extract pixels from the sprite sheet For now, return empty arrayline 695
public int getLoopCount()Returns loopCount.line 455
public int getPlayDirection()Returns playDirection.line 279
public float getProgress()3 statement(s).line 456
public int getStartFrame()Returns startFrame.line 447
public Color getTintColor()Returns tintColor.line 545
public float getTintIntensity()Returns tintIntensity.line 546
public int getTotalFrames()Returns totalClips.line 453
public void gotoFrame(int frame)3 statement(s); calls Math.max(), Math.min(), onFrameChange(), fireFrameChanged().line 309
public boolean hasCollisionAnim()Returns collisionSequence != null.line 616
public boolean isHorizontalFlipped()Returns horizontalFlip.line 511
public boolean isLooping()Returns loop.line 269
public boolean isPingPongMode()Returns pingPongMode.line 302
public boolean isPlaying()Returns playing.line 454
public boolean isVerticalFlipped()Returns verticalFlip.line 512
public void nextFrame()3 statement(s); calls fireBounce(), fireLoopComplete(), stop(), fireAnimationComplete(), onFrameChange() ….line 322
public void onFrameChange()Default: notify registered frame listenerline 704
Image outlineImage()No comment in source.line 728
public void pause()Sets playing = false.line 229
public void prevFrame()3 statement(s); calls onFrameChange(), fireFrameChanged().line 395
public void removeFrameListener()Sets this.frameListener = null.line 555
public void resetFrameRange()2 statement(s).line 441
public void restart()7 statement(s); calls System.currentTimeMillis(), fireFrameChanged().line 240
public void resume()2 statement(s); calls System.currentTimeMillis().line 234
public void reverse()Sets playDirection = -playDirection.line 284
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.line 721
public boolean setCollisionAnim(AnimGob anm)2 statement(s).line 605
public void setFPS(int framesPerSecond)1 statement(s).line 465
public void setFrameDelay(int milliseconds)Sets this.frameDelay = Math.max(1, milliseconds).line 254
public void setFrameListener(AnimGob.AnimFrameListener listener)Sets this.frameListener = listener.line 550
public void setFrameRange(int start, int end)4 statement(s); calls Math.max(), Math.min().line 429
public void setHorizontalFlip(boolean flip)2 statement(s).line 493
public void setLoop(boolean shouldLoop)Sets this.loop = shouldLoop.line 264
public void setPingPongMode(boolean enable)2 statement(s).line 289
public void setPlayDirection(int direction)Sets this.playDirection = (direction >= 0) ? 1 : -1.line 274
public void setSpeed(float speedFactor)2 statement(s); calls getFPS().line 665
public void setTint(Color tintColor)2 statement(s).line 526
public void setTint(Color tintColor, float intensity)3 statement(s); calls Math.max(), Math.min().line 532
public void setVerticalFlip(boolean flip)2 statement(s).line 502
public void slowDown(float factor)1 statement(s).line 671
public void speedUp(float factor)1 statement(s).line 677
int[] spriteRect()V3.23: the clip being shown (picking by alpha, rotated drawing)line 734
public void start()1 statement(s); calls System.currentTimeMillis(), fireAnimationStarted().line 210
public void stop()1 statement(s); calls fireAnimationStopped().line 220
public void toggleHorizontalFlip()1 statement(s); calls setHorizontalFlip().line 514
public void toggleVerticalFlip()1 statement(s); calls setVerticalFlip().line 519
public String toString()Returns "AnimGob[" + gobName + ", frame=" + curClip + "/" + totalClips + ", playing=" + playing + ", fps=" +.
Overrides Gob.toString()
line 839
public int tracedClipOutlines()Number of clips whose outline has been traced so far (a test reads it).line 751
public void updateAnimation()3 statement(s); calls System.currentTimeMillis(), nextFrame().line 479

Nested & additional classes

AnimFrameListener (nested type, lines 58–65)

public abstract static interface AnimFrameListener

Fields (0)

None declared.

Constructors (0)

None (interface).

Methods (5)

SignatureDescriptionSource
public abstract void onAnimationComplete(AnimGob source)Interface method (no body); implemented by classes that implement this interface.line 61
public abstract void onAnimationStarted(AnimGob source)Interface method (no body); implemented by classes that implement this interface.line 63
public abstract void onAnimationStopped(AnimGob source)Interface method (no body); implemented by classes that implement this interface.line 64
public abstract void onFrameChanged(AnimGob source, int oldFrame, int newFrame)Interface method (no body); implemented by classes that implement this interface.line 60
public abstract void onLoopComplete(AnimGob source, int loopCount)Interface method (no body); implemented by classes that implement this interface.line 62

Inherited members

Non-private members inherited from HyperView superclasses and not overridden or hidden here.

From Gob (75 fields, 27 methods)

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()

From Linkable (7 fields, 2 methods)

Fields: attachment, index, linkFlags, name, next, parentList, prev

Methods: inList(), setName(String)

Examples

Real usage taken from elsewhere in the HyperView 3.2 source (file and line shown; source path src/com/multiversesocial/hyperview/).

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;
Hits--