public class Animation extends Control
Control.TranslucentShape| Modifier and Type | Field and Description |
|---|---|
protected Image |
background
Background image.
|
protected int |
curFrame
The current frame.
|
int |
drawOp
Dumb field to keep compilation compatibility with TC 1.
|
static int |
eventFinish
Notifies animation endings.
|
static int |
eventFrame
Notifies animation frames.
|
static int |
eventLoop
Notifies animation loops.
|
static int |
eventNone
No notify at all.
|
protected int |
eventsMask
Event notification mask, whose value is
eventFinish |
int |
framePeriod
Delay between two frames.
|
Image |
framesBuffer
Frames buffer.
|
boolean |
isPaused
Reflects the animation pause state.
|
boolean |
isPlaying
Reflects the animation play state.
|
static int |
LOOPS_UNLIMITED
start() method loops argument special value to loop endlessly. |
boolean |
pauseIfNotVisible
Sets to true to stop the animation if its parent window is not the top most.
|
AFTER, alphaValue, appId, appObj, asContainer, asWindow, backColor, BEFORE, BOTTOM, BOTTOM_OF, BRIGHTER_BACKGROUND, callListenersOnAllTargets, CENTER, CENTER_OF, clearValueInt, clearValueStr, DARKER_BACKGROUND, DP, effect, enableUpdateScreen, esce, eventsEnabled, FILL, fillColor, FIT, floating, fm, fmH, focusHandler, focusLess, focusOnPenDown, focusTraversable, font, FONTSIZE, foreColor, height, ignoreInsets, isHighlighting, isTablet, KEEP, keepDisabled, keepEnabled, LEFT, next, nextTabControl, npParts, offscreen, offscreen0, onEventFirst, parent, PARENTSIZE, PARENTSIZEMAX, PARENTSIZEMIN, PREFERRED, prev, RANGE, repositionAllowed, RIGHT, RIGHT_OF, SAME, SCREENSIZE, SCREENSIZEMAX, SCREENSIZEMIN, setFont, setH, setRel, setW, setX, SETX_NOT_SET, setY, tempW, textShadowColor, TOP, translucentShape, transparentBackground, uiAdjustmentsBasedOnFontHeightIsSupported, uiAndroid, UICONST, uiFlat, uiHolo, uiMaterial, uiVista, visible, width, WILL_RESIZE, x, y| Modifier | Constructor and Description |
|---|---|
protected |
Animation()
Animation constructor.
|
|
Animation(Image frames,
int framePeriod)
Animation constructor.
|
|
Animation(Image frames,
int frameCount,
int framePeriod)
Animation constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
enableEvents(int mask)
Enable the posting of events.
|
int |
getPreferredHeight()
Returns the preferred height of this control.
|
int |
getPreferredWidth()
Returns the preferred width of this control.
|
void |
onEvent(Event e)
Process events for the
Animation class. |
void |
onPaint(Graphics gfx)
Called by the system to draw the animation.
|
void |
pause()
Pauses a running animation.
|
void |
resume()
Resumes a paused animation.
|
void |
setImage(Image frames,
int frameCount,
int framePeriod)
Sets the image of an
Animation object. |
int |
size()
Number of frames in the animation.
|
void |
start(int loops)
Starts the animation.
|
void |
start(int sFrame,
int eFrame,
int step,
int loops)
Starts the animation with a frame range.
|
void |
stop()
Stops the animation.
|
_onEvent, addEnabledStateListener, addFocusListener, addFontChangeHandler, addGridListener, addHandler, addHighlightListener, addKeyListener, addListContainerListener, addMouseListener, addMultiTouchListener, addPenListener, addPressListener, addPushNotificationListener, addSizeChangeHandler, addTimer, addTimer, addTimerListener, addValueChangeHandler, addWindowListener, bringToFront, changeHighlighted, clear, contains, drawTranslucentBackground, getAbsoluteRect, getBackColor, getDoEffect, getEffectH, getEffectW, getEffectX, getEffectY, getEventListeners, getFont, getForeColor, getGap, getGraphics, getHeight, getNext, getParent, getParentWindow, getPos, getPressedEvent, getPrev, getRect, getSize, getTextShadowColor, getWidth, getX, getX2, getY, getY2, hadParentScrolled, handleGeographicalFocusChangeKeys, hasFocus, internalSetEnabled, intXYWH, isActionEvent, isChildOf, isDisplayed, isEnabled, isFloating, isInsideOrNear, isObscured, isTopMost, isVisible, isVisibleAndInside, onBoundsChanged, onColorsChanged, onFontChanged, onWindowPaintFinished, post, postEvent, postPressedEvent, releaseScreenShot, removeEnabledStateListener, removeFocusListener, removeGridListener, removeHandler, removeHighlightListener, removeKeyListener, removeListContainerListener, removeMouseListener, removeMultiTouchListener, removePenListener, removePressListener, removePushNotificationListener, removeTimer, removeTimerListener, removeWindowListener, repaint, repaintNow, reposition, reposition, repositionChildren, requestFocus, resetSetPositions, resetStyle, safeRepaintNow, safeUpdateScreen, sendToBack, setBackColor, setBackForeColors, setDoEffect, setEnabled, setFloating, setFocusLess, setFont, setForeColor, setNinePatch, setNinePatch, setRect, setRect, setRect, setRect, setSet, setTextShadowColor, setTranslucent, setVisible, showTip, takeInitialScreenShot, takeScreenShot, translateFromOrigin, uiStyleChanged, updateScreen, updateTemporary, willOpenKeyboardpublic boolean pauseIfNotVisible
public int framePeriod
public boolean isPlaying
public boolean isPaused
public Image framesBuffer
protected int eventsMask
eventFinish, which means that an event is posted only when the animation finishes.public static final int eventNone
public static final int eventFinish
public static final int eventLoop
public static final int eventFrame
public static final int LOOPS_UNLIMITED
start() method loops argument special value to loop endlessly.protected int curFrame
public int drawOp
protected Image background
protected Animation()
public Animation(Image frames, int framePeriod) throws ImageException
frames - Single image containing all frames. The number of frames and the transparent colors are fetched from the image.framePeriod - Delay in milliseconds between two frames.ImageException - If an internal method throws it.public Animation(Image frames, int frameCount, int framePeriod) throws ImageException
frames - single image containing all frames.frameCount - width in pixels of one frame.framePeriod - delay in milliseconds between two frames.ImageException - If an internal method throws it.public void setImage(Image frames, int frameCount, int framePeriod) throws ImageException
Animation object.frames - single image containing all frames.frameCount - width in pixels of one frame.framePeriod - delay in milliseconds between two frames.ImageException - If an internal method throws it.public void onEvent(Event e)
Animation class.public int size()
public int getPreferredWidth()
getPreferredWidth in class Controlpublic int getPreferredHeight()
getPreferredHeight in class Controlpublic void onPaint(Graphics gfx)
public void enableEvents(int mask)
public void pause()
public void resume()
public void stop()
public void start(int sFrame,
int eFrame,
int step,
int loops)
sFrame - The start frame.eFrame - The end frame.step - The frame increment.loops - The number of animation iterations.public void start(int loops)
loops - Integer value specifying the number of loops or LOOPS_UNLIMITED for an infinite loop.LOOPS_UNLIMITED