Back to project page TileView.
The source code is released under:
MIT License
If you think the Android project TileView listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.qozix.animation; // w w w .jav a 2 s.co m import java.util.ArrayList; import android.os.Handler; import android.os.Message; import com.qozix.animation.easing.EasingEquation; import com.qozix.animation.easing.Linear; // TODO: the singleton Handler might leak... public class Tween { private double ellapsed; private double startTime; private double duration = 500; private ArrayList<TweenListener> listeners = new ArrayList<TweenListener>(); private EasingEquation ease = Linear.EaseNone; public double getEllapsed(){ return ellapsed; } public void setEllapsed( double time ){ ellapsed = time; } public double getProgress() { return ellapsed / duration; } public double getEasedProgress() { return ease.compute( ellapsed, 0, 1, duration ); } public void setAnimationEase( EasingEquation e ) { if ( e == null ) { e = Linear.EaseNone; } ease = e; } public ArrayList<TweenListener> getTweenListeners() { return listeners; } public void addTweenListener( TweenListener l ) { listeners.add( l ); } public void removeTweenListener( TweenListener l ) { listeners.remove( l ); } public double getStartTime() { return startTime; } public double getDuration() { return duration; } public void setDuration( double time ) { duration = time; } public void start() { stop(); ellapsed = 0; startTime = System.currentTimeMillis(); for ( TweenListener l : listeners ) { l.onTweenStart(); } TweenHandler handler = TweenHandler.getInstance(); handler.addTween( this ); } public void stop() { TweenHandler handler = TweenHandler.getInstance(); handler.removeTween( this ); } }