Back to project page AdoreLib.
The source code is released under:
MIT License
If you think the Android project AdoreLib 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.ylinval.adore.adorelib.Libs.Tween; /* www. j a v a 2 s. co m*/ /** * Created by jdourlens on 5/10/14. */ // Name took from tween.lua but not really related public class Tween { protected int start; protected int end; protected int duration; protected int elapsed; protected boolean finished; public Tween(int start, int end, int duration) { this.start = start; this.end = end; this.duration = duration; this.elapsed = 0; this.finished = false; } // reset the elapsed time so we can make new transition public void reset() { this.elapsed = 0; this.finished = false; } public int update(int dt) { this.elapsed += dt; if (this.elapsed > duration) this.finished = true; else { return (compute()); } return (end); } public int compute() { return (((this.end - this.start) * this.elapsed) / this.duration + this.start); } public boolean isFinished() { return (this.finished); } public int getStart() { return start; } public void setStart(int start) { this.start = start; } public int getEnd() { return end; } public void setEnd(int end) { this.end = end; } public int getDuration() { return duration; } public void setDuration(int duration) { this.duration = duration; } }