OnSwipe
class OnSwipe
Create automatic swipe handling object
Summary
Nested types |
|---|
enum OnSwipe.Boundary |
enum OnSwipe.Drag |
enum OnSwipe.Mode |
enum OnSwipe.Side |
enum OnSwipe.TouchUp |
Public constructors |
|---|
OnSwipe() |
OnSwipe(anchor: String!, side: OnSwipe.Side!, dragDirection: OnSwipe.Drag!) |
Public functions |
|
|---|---|
OnSwipe.Mode! |
|
OnSwipe.Drag! |
|
Float |
|
Float |
|
String! |
|
Float |
|
Float |
|
OnSwipe.TouchUp! |
|
String! |
|
OnSwipe.Boundary! |
The behaviour at the boundaries 0 and 1 |
Float |
|
Float |
Get the mass of the spring. the m in "a = (-k*x-c*v)/m" equation for the acceleration of a spring |
Float |
get the stiffness of the spring |
Float |
The threshold for spring motion to stop. |
String! |
|
OnSwipe.Side! |
|
Unit |
setAutoCompleteMode(autoCompleteMode: OnSwipe.Mode!)sets the behaviour at the boundaries 0 and 1 COMPLETE_MODE_CONTINUOUS_VELOCITY = 0; COMPLETE_MODE_SPRING = 1; |
OnSwipe! |
setDragDirection(dragDirection: OnSwipe.Drag!)The direction of the drag. |
OnSwipe! |
setDragScale(dragScale: Int)Normally 1 this can be tweaked to make the acceleration faster |
OnSwipe! |
setDragThreshold(dragThreshold: Int)This sets the threshold before the animation is kicked off. |
OnSwipe! |
setLimitBoundsTo(id: String!)Only allow touch actions to be initiated within this region |
OnSwipe! |
setMaxAcceleration(maxAcceleration: Int)The maximum acceleration and deceleration of the animation (Change in Change in progress per second) Faster makes the object seem lighter and quicker |
OnSwipe! |
setMaxVelocity(maxVelocity: Int)The maximum velocity (Change in progress per second) animation can achieve |
OnSwipe! |
setOnTouchUp(mode: OnSwipe.TouchUp!)Configures what happens when the user releases on mouse up. |
OnSwipe! |
setRotateCenter(rotationCenterId: String!)The view to center the rotation about |
OnSwipe! |
setSpringBoundary(springBoundary: OnSwipe.Boundary!)The behaviour at the boundaries 0 and 1. |
OnSwipe! |
setSpringDamping(springDamping: Float)Set the damping of the spring if using spring. c in "a = (-k*x-c*v)/m" equation for the acceleration of a spring |
OnSwipe! |
setSpringMass(springMass: Float)Set the Mass of the spring if using spring. m in "a = (-k*x-c*v)/m" equation for the acceleration of a spring |
OnSwipe! |
setSpringStiffness(springStiffness: Float)set the stiffness of the spring if using spring. |
OnSwipe! |
setSpringStopThreshold(springStopThreshold: Float)set the threshold for spring motion to stop. |
OnSwipe! |
setTouchAnchorId(id: String!)The id of the view who's movement is matched to your drag If not specified it will map to a linear movement across the width of the motionLayout |
OnSwipe! |
setTouchAnchorSide(side: OnSwipe.Side!)This side of the view that matches the drag movement. |
String! |
toString() |
Constants
Public constructors
Public functions
getSpringBoundary
fun getSpringBoundary(): OnSwipe.Boundary!
The behaviour at the boundaries 0 and 1
getSpringMass
fun getSpringMass(): Float
Get the mass of the spring. the m in "a = (-k*x-c*v)/m" equation for the acceleration of a spring
getSpringStiffness
fun getSpringStiffness(): Float
get the stiffness of the spring
| Returns | |
|---|---|
Float |
NaN if not set |
getSpringStopThreshold
fun getSpringStopThreshold(): Float
The threshold for spring motion to stop.
setAutoCompleteMode
fun setAutoCompleteMode(autoCompleteMode: OnSwipe.Mode!): Unit
sets the behaviour at the boundaries 0 and 1 COMPLETE_MODE_CONTINUOUS_VELOCITY = 0; COMPLETE_MODE_SPRING = 1;
setDragDirection
fun setDragDirection(dragDirection: OnSwipe.Drag!): OnSwipe!
The direction of the drag.
setDragScale
fun setDragScale(dragScale: Int): OnSwipe!
Normally 1 this can be tweaked to make the acceleration faster
setDragThreshold
fun setDragThreshold(dragThreshold: Int): OnSwipe!
This sets the threshold before the animation is kicked off. It is important when have multi state animations the have some play before the System decides which animation to jump on.
setLimitBoundsTo
fun setLimitBoundsTo(id: String!): OnSwipe!
Only allow touch actions to be initiated within this region
setMaxAcceleration
fun setMaxAcceleration(maxAcceleration: Int): OnSwipe!
The maximum acceleration and deceleration of the animation (Change in Change in progress per second) Faster makes the object seem lighter and quicker
setMaxVelocity
fun setMaxVelocity(maxVelocity: Int): OnSwipe!
The maximum velocity (Change in progress per second) animation can achieve
setOnTouchUp
fun setOnTouchUp(mode: OnSwipe.TouchUp!): OnSwipe!
Configures what happens when the user releases on mouse up. One of: ON_UP_AUTOCOMPLETE, ON_UP_AUTOCOMPLETE_TO_START, ON_UP_AUTOCOMPLETE_TO_END, ON_UP_STOP, ON_UP_DECELERATE, ON_UP_DECELERATE_AND_COMPLETE
| Parameters | |
|---|---|
mode: OnSwipe.TouchUp! |
default = ON_UP_AUTOCOMPLETE |
setRotateCenter
fun setRotateCenter(rotationCenterId: String!): OnSwipe!
The view to center the rotation about
| Returns | |
|---|---|
OnSwipe! |
this |
setSpringBoundary
fun setSpringBoundary(springBoundary: OnSwipe.Boundary!): OnSwipe!
The behaviour at the boundaries 0 and 1.
| Parameters | |
|---|---|
springBoundary: OnSwipe.Boundary! |
behaviour at the boundaries |
setSpringDamping
fun setSpringDamping(springDamping: Float): OnSwipe!
Set the damping of the spring if using spring. c in "a = (-k*x-c*v)/m" equation for the acceleration of a spring
| Returns | |
|---|---|
OnSwipe! |
this |
setSpringMass
fun setSpringMass(springMass: Float): OnSwipe!
Set the Mass of the spring if using spring. m in "a = (-k*x-c*v)/m" equation for the acceleration of a spring
| Returns | |
|---|---|
OnSwipe! |
this |
setSpringStiffness
fun setSpringStiffness(springStiffness: Float): OnSwipe!
set the stiffness of the spring if using spring. If this is set the swipe will use a spring return system. If set to NaN it will revert to the norm system. K in "a = (-k*x-c*v)/m" equation for the acceleration of a spring
setSpringStopThreshold
fun setSpringStopThreshold(springStopThreshold: Float): OnSwipe!
set the threshold for spring motion to stop. This is in change in progress / second If the spring will never go above that threshold again it will stop.
| Parameters | |
|---|---|
springStopThreshold: Float |
when to stop. |
setTouchAnchorId
fun setTouchAnchorId(id: String!): OnSwipe!
The id of the view who's movement is matched to your drag If not specified it will map to a linear movement across the width of the motionLayout
setTouchAnchorSide
fun setTouchAnchorSide(side: OnSwipe.Side!): OnSwipe!
This side of the view that matches the drag movement. Only meaning full if the object changes size during the movement. (rotation is not considered)