Kaplay.Animate
Modules
Comp
Types
animateCompOpt
type animateCompOpt = {followMotion?: bool, relative?: bool}Fields
followMotion option < bool >
relative option < bool >
animateOpt
type animateOpt = { duration: float, loops?: int, direction?: Kaplay.Types.timeDirection, interpolation?: Kaplay.Types.interpolation, timestamps?: array<float>, easing?: array<Kaplay.Types.easeFunc>,}Fields
duration float
loops option < int >
direction option < Kaplay.Types.timeDirection >
interpolation option < Kaplay.Types.interpolation >
timestamps option < array >
easing option < array >
animation
type animation = { mutable paused: bool, seek: float => unit, duration: float,}Fields
paused bool
seek float =
duration float
Values
addAnimateComponent
addAnimate(context, ~options=?) => comp to animate properties.
let addAnimate: ( Kaplay.Context.t, ~options: animateCompOpt=?,) => Kaplay.Types.compReturn type
animate
animate(context, property name, keys, options) to animate properties.
keys are generic to match the values of the property.
myGameObject->MyModule.animate(
"pos",
[k->Context.vec2(100., 200.), k->Context.vec2(200., 300.)],
{duration: 1.},
)
let animate: (T.t, string, array<'key>, animateOpt) => unitReturn type
unit
getAnimation
let getAnimation: T.t => animationParameters
T.t
Return type
onAnimateChannelFinished
onAnimateChannelFinished(context, property name, (t) => unit) attaches an event handler which is called when an animation channels has finished.
let onAnimateChannelFinished: (T.t, string => unit) => unitParameters
T.t
string
unit
Return type
unit
onAnimateChannelFinishedWithController
onAnimateChannelFinished(context, property name, (t) => unit) attaches an event handler which is called when an animation channels has finished.
let onAnimateChannelFinishedWithController: (T.t, string => unit) => Kaplay.KEventController.tParameters
T.t
string
unit
Return type
onAnimateFinished
Attaches an event handler which is called when all the animation channels have finished.
let onAnimateFinished: (T.t, unit => unit) => unitParameters
T.t
unit
unit
Return type
unit
onAnimateFinishedWithController
Attaches an event handler which is called when all the animation channels have finished.
let onAnimateFinishedWithController: (T.t, unit => unit) => Kaplay.KEventController.tParameters
T.t
unit
unit
Return type
unanimate
unanimate(context, property name) to stop animating a property.
let unanimate: (T.t, string) => unitParameters
T.t
string
Return type
unit
unanimateAll
let unanimateAll: T.t => unitParameters
T.t
Return type
unit