Class VectorGlider
java.lang.Object
com.github.yellowstonegames.smooth.Glider
com.github.yellowstonegames.smooth.VectorGlider
Allows specifying a smoothly-changing float position using a libGDX Vector2 for the start and the end, with a change
amount that affects how far a position has moved from start to end. Typical usage sets the start with
This is extremely similar to
This is a type of Glider, and so is compatible with other Gliders (it can also be merged with them).
setStart(Vector2) once and the end more than once with setEnd(Vector2), changing the end each time the
move is complete. The x and y positions are automatically calculated in getX() and getY(), and
their values will be different every time Glider.setChange(float) is called with a different amount. You can
optionally use an Interpolation to make the rate of change different.
This is extremely similar to
CoordGlider, but instead of locking positions to integer coordinates, this
allows movement to non-integer positions. This should be useful for small movements like shaking or bumping.
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
FieldsModifier and TypeFieldDescriptionprotected com.badlogic.gdx.math.Vector2protected com.badlogic.gdx.math.Vector2Fields inherited from class Glider
change, changers, completeRunner, interpolation -
Constructor Summary
ConstructorsConstructorDescriptionVectorGlider(com.badlogic.gdx.math.Vector2 end) AssignsVector2.Zerointo start and end into end; does not continue to use the reference to the parameter end, or Zero.VectorGlider(com.badlogic.gdx.math.Vector2 start, com.badlogic.gdx.math.Vector2 end) Copies start into start and end into end; does not continue to use references to the parameters.VectorGlider(com.badlogic.gdx.math.Vector2 start, com.badlogic.gdx.math.Vector2 end, com.github.tommyettinger.digital.Interpolations.Interpolator interpolation, Runnable completeRunner) Copies start into start and end into end; does not continue to use references to the parameters.VectorGlider(Glider other) VectorGlider(VectorGlider other) -
Method Summary
Methods inherited from class Glider
addChanger, addChangers, addChangers, equals, getChange, getCompleteRunner, getEndFloat, getEndInt, getFloat, getInt, getInterpolation, getStartFloat, getStartInt, hashCode, merge, removeChanger, resetToCurrent, setChange, setCompleteRunner, setEndFloat, setEndInt, setInterpolation, setStartFloat, setStartInt
-
Field Details
-
start
protected com.badlogic.gdx.math.Vector2 start -
end
protected com.badlogic.gdx.math.Vector2 end
-
-
Constructor Details
-
VectorGlider
public VectorGlider() -
VectorGlider
public VectorGlider(com.badlogic.gdx.math.Vector2 end) AssignsVector2.Zerointo start and end into end; does not continue to use the reference to the parameter end, or Zero.- Parameters:
end- will be copied into end
-
VectorGlider
public VectorGlider(com.badlogic.gdx.math.Vector2 start, com.badlogic.gdx.math.Vector2 end) Copies start into start and end into end; does not continue to use references to the parameters.- Parameters:
start- will be copied into startend- will be copied into end
-
VectorGlider
public VectorGlider(com.badlogic.gdx.math.Vector2 start, com.badlogic.gdx.math.Vector2 end, com.github.tommyettinger.digital.Interpolations.Interpolator interpolation, Runnable completeRunner) Copies start into start and end into end; does not continue to use references to the parameters.- Parameters:
start- will be copied into startend- will be copied into endinterpolation- how to interpolate from start to end; typically a constant fromInterpolationcompleteRunner- a Runnable that, if non-null, will be run when the glide completes
-
VectorGlider
-
VectorGlider
-
-
Method Details
-
getX
public float getX() -
getY
public float getY() -
getStart
public com.badlogic.gdx.math.Vector2 getStart() -
setStart
public void setStart(com.badlogic.gdx.math.Vector2 start) -
getEnd
public com.badlogic.gdx.math.Vector2 getEnd() -
setEnd
public void setEnd(com.badlogic.gdx.math.Vector2 end) -
onComplete
public void onComplete()- Overrides:
onCompletein classGlider
-
toString
-