Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.infunity.tothemoon.TweenAccessors;
- import aurelienribon.tweenengine.TweenAccessor;
- import com.badlogic.gdx.scenes.scene2d.Actor;
- public class ActorTween implements TweenAccessor<Actor> {
- public static final int POSITION_X = 1;
- public static final int POSITION_Y = 2;
- public static final int POSITION_XY = 3;
- public static final int SCALE = 4;
- @Override
- public int getValues(Actor target, int tweenType, float[] returnValues) {
- switch(tweenType){
- case POSITION_X: returnValues[0] = target.getX(); return 1;
- case POSITION_Y: returnValues[0] = target.getY(); return 1;
- case POSITION_XY:
- returnValues[0] = target.getX();
- returnValues[1] = target.getY();
- return 2;
- case SCALE:
- returnValues[0] = target.getScaleX();
- returnValues[1] = target.getScaleY();
- return 2;
- default: assert false; return -1;
- }
- }
- @Override
- public void setValues(Actor target, int tweenType, float[] newValues) {
- switch(tweenType){
- case POSITION_X: target.setX(newValues[0]); break;
- case POSITION_Y: target.setY(newValues[0]); break;
- case POSITION_XY:
- target.setX(newValues[0]);
- target.setY(newValues[1]);
- break;
- case SCALE:
- target.setScale(newValues[0], newValues[1]);
- break;
- default: assert false; break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement