📄 animation.java
字号:
// Copyright (c) 2005 Sony Ericsson Mobile Communications AB
//
// This software is provided "AS IS," without a warranty of any kind.
// ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
// INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
// PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
//
// THIS SOFTWARE IS COMPLEMENTARY OF JAYWAY AB (www.jayway.se)
package bluegammon.gui.animation;
import javax.microedition.lcdui.Graphics;
/**
* This abstract class represents an animation and is
* handled by the <code>AnimationEngine</code>
* @author Peter Andersson
*/
public abstract class Animation
{
/** Time of last invokation of <code>next</code> on this animation. */
protected long m_lastInvoke = System.currentTimeMillis();
/**
* Override this to invoke functionality at the
* start of this animation
*/
public void onStart() {}
/**
* Draws the animation using the specified graphics context.
* @param g The graphics context.
*/
public abstract void paint(Graphics g);
/**
* Called each time the animation should be updated.
*/
public abstract void next();
/**
* Probes to check if the animation can be removed
* @return true if finished, false if still active
*/
public abstract boolean isFinished();
/**
* Returns interval time in milliseconds when the animation should be updated,
* i.e. the <code>next</code> method is invoked.
* @return update interval in milliseconds.
*/
public abstract long getInterval();
/**
* Called from animation engine
* @param t Current time
*/
public void callNext(long t)
{
m_lastInvoke = t;
next();
}
/**
* Returns last update in milliseconds
* @return The time of last update
*/
public long getLastInvoke()
{
return m_lastInvoke;
}
/**
* Override this to invoke functionality at the
* end of this animation
*/
public void onExit() {}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -