Game Development Reference
In-Depth Information
Figure 8.20
Five types of tween functions.
The Tween Class
The Tween class encapsulates the idea of representing a variable's value over
time. Here is the full working class.
public class Tween
{
double _original;
double _distance;
double _current;
double _totalTimePassed = 0;
double _totalDuration = 5;
bool _finished = false;
TweenFunction _tweenF = null;
public delegate double TweenFunction(double timePassed, double start,
double distance, double duration);
public double Value()
{
return _current;
}
public bool IsFinished()
{
return _finished;
}
 
Search WWH ::




Custom Search