package aurelienribon.tweenengine; /** * The TweenAccessor interface lets you interpolate any attribute from any * object. Just implement it as you want and register it to the engine by * calling {@link Tween#registerAccessor}. *
* * {@code
* public class ParticleAccessor implements TweenAccessor {
* public static final int X = 1;
* public static final int Y = 2;
* public static final int XY = 3;
*
* public int getValues(Particle target, int tweenType, float[] returnValues) {
* switch (tweenType) {
* case X: returnValues[0] = target.getX(); return 1;
* case Y: returnValues[0] = target.getY(); return 1;
* case XY:
* returnValues[0] = target.getX();
* returnValues[1] = target.getY();
* return 2;
* default: assert false; return 0;
* }
* }
*
* public void setValues(Particle target, int tweenType, float[] newValues) {
* switch (tweenType) {
* case X: target.setX(newValues[0]); break;
* case Y: target.setY(newValues[1]); break;
* case XY:
* target.setX(newValues[0]);
* target.setY(newValues[1]);
* break;
* default: assert false; break;
* }
* }
* }
* }
*
* Once done, you only need to register this TweenAccessor once to be able to
* use it for every Particle objects in your application:
*
*
* {@code
* Tween.registerAccessor(Particle.class, new ParticleAccessor());
* }
*
* And that's all, the Tween Engine can no work with all your particles!
*
* @author Aurelien Ribon | http://www.aurelienribon.com/
*/
public interface TweenAccessor