Class AngleGlider
java.lang.Object
com.github.yellowstonegames.smooth.Glider
com.github.yellowstonegames.smooth.AngleGlider
Allows specifying a smoothly-changing float value that represents an angle, using floats measured in turns (between
0 and 1) for start and end, with a change amount that affects how far the value has changed from start to end. This
always chooses between clockwise or counterclockwise by preferring the shorter rotation distance. Typical usage sets
the start with
Note that because this measures angles in turns, it is meant to either be used with code that already expects turns, like
This is a type of Glider, and so is compatible with other Gliders (it can also be merged with them).
setStart(float) once and the end more than once with setEnd(float), changing the end
each time the transition is complete. The value is automatically calculated in getAngle(), and its value
will be different every time Glider.setChange(float) is called with a different amount. You can
optionally use an Interpolations.Interpolator to make the rate of change different.
Note that because this measures angles in turns, it is meant to either be used with code that already expects turns, like
TrigTools.sinTurns(float), or to have the angle in turns converted to
radians (by multiplying an angle in turns by TrigTools.PI2) or to degrees
(by multiplying an angle in turns by 360)).
This is a type of Glider, and so is compatible with other Gliders (it can also be merged with them).
-
Nested Class Summary
Nested classes/interfaces inherited from class Glider
Glider.Changer -
Field Summary
Fields inherited from class Glider
change, changers, completeRunner, interpolation -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class Glider
addChanger, addChangers, addChangers, equals, getChange, getCompleteRunner, getEndFloat, getEndInt, getFloat, getInt, getInterpolation, getStartFloat, getStartInt, hashCode, merge, onComplete, removeChanger, resetToCurrent, setChange, setCompleteRunner, setEndFloat, setEndInt, setInterpolation, setStartFloat, setStartInt
-
Constructor Details
-
AngleGlider
public AngleGlider() -
AngleGlider
public AngleGlider(float start) -
AngleGlider
public AngleGlider(float start, float end)
-
-
Method Details
-
getAngle
public float getAngle() -
getStart
public float getStart() -
setStart
public void setStart(float start) -
getEnd
public float getEnd() -
setEnd
public void setEnd(float end)
-