games.rednblack.editor.renderer.systems.action.logic.RotateToAction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of runtime-libgdx Show documentation
Show all versions of runtime-libgdx Show documentation
HyperLap2D libGDX runtime to render exported scenes
The newest version!
package games.rednblack.editor.renderer.systems.action.logic;
import games.rednblack.editor.renderer.components.TransformComponent;
import games.rednblack.editor.renderer.systems.action.data.RotateToData;
/**
* Created by ZeppLondon on 10/16/2015.
*/
public class RotateToAction extends TemporalAction {
@Override
protected void update(float percent, int entity, T actionData) {
TransformComponent transformComponent = transformMapper.get(entity);
if (transformComponent == null) return;
transformComponent.rotation = (actionData.start + (actionData.end - actionData.start) * percent);
}
@Override
public void begin(int entity, T actionData) {
TransformComponent transformComponent = transformMapper.get(entity);
if (transformComponent == null) return;
actionData.start = transformComponent.rotation;
}
}