Hello, i'm trying to reproduce sprites animations using the ObjectAnimation and a Sprite class that is basicaly a rectangle, but the problem is: if a insert three or more values to the class animate between, he just consider two values, the first and the last, when the evaluate method from my evaluate class is called, the fraction only interpolate between 0.0 and 1.0, no intermediate, so i do not have an animation, here is my test code:
animation = ObjectAnimator.ofObject(object, "update", new SpriteEvaluator(),
new Sprite(0, 0, 32, 32, 100, 3),
new Sprite(64, 0, 32, 32, 100, 3),
new Sprite(32, 0, 32, 32, 100, 3));
animation.start();
EDITED___: The four first parameters of the Sprite class are the most important here:
x, y, w,h, delay, count.
The SpriteEvaluator class is here:
private class SpriteEvaluator implements TypeEvaluator<Sprite>{
@Override
public Sprite evaluate(float fraction, Sprite startValue, Sprite endValue) {
int c = (int)fraction*(startValue.count-1);
return new Sprite(startValue.w*c, startValue.y, startValue.w, startValue.h, startValue.delay, startValue.count);
}
}
am i doing something wrong?? cause i've see some examples that use more than 3 values and works good, i'm almost giving up and drop this thing to create my own animation class in the C++ style, where i can ask to the class if is time to actualize in the main loop, but how this is android, i'm afraid to do things by the "old" way.
Thank you all already.