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.comp
Return 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) => unit
Return type
unit
getAnimation
let getAnimation: T.t => animation
Parameters
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) => unit
Parameters
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.t
Parameters
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) => unit
Parameters
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.t
Parameters
T.t
unit
unit
Return type
unanimate
unanimate(context, property name)
to stop animating a property.
let unanimate: (T.t, string) => unit
Parameters
T.t
string
Return type
unit
unanimateAll
let unanimateAll: T.t => unit
Parameters
T.t
Return type
unit