Skip to content

editor › Globals › KyubAnimation

Class: KyubAnimation ‹T›

An animation changes a specific value on a target over time

Type parameters

▪ T

Hierarchy

  • KyubAnimation

↳ NumberAnimation

↳ Vec3Animation

↳ QuaternionAnimation

Index

Properties

Methods

Properties

Private duration

• duration: number | null = null

Defined in src/renderContext/animations/KyubAnimation.ts:15


Private getterFunction

• getterFunction: function | null = null

Defined in src/renderContext/animations/KyubAnimation.ts:21


Private hasFinished

• hasFinished: boolean = false

Defined in src/renderContext/animations/KyubAnimation.ts:26


Private hasStarted

• hasStarted: boolean = false

Defined in src/renderContext/animations/KyubAnimation.ts:25


Private initialDelay

• initialDelay: number = 0

Defined in src/renderContext/animations/KyubAnimation.ts:17


Private interpolation

• interpolation: Interpolation = new LinearInterpolation()

Defined in src/renderContext/animations/KyubAnimation.ts:18


Private onStartCallback

• onStartCallback: function | null = null

Defined in src/renderContext/animations/KyubAnimation.ts:23


Private promise

• promise: Promise‹void› = new Promise(resolve => (this.promiseResolveFunc = resolve))

Defined in src/renderContext/animations/KyubAnimation.ts:20


Private promiseResolveFunc

• promiseResolveFunc: function | null = null

Defined in src/renderContext/animations/KyubAnimation.ts:19


Private runtime

• runtime: number | null = null

Defined in src/renderContext/animations/KyubAnimation.ts:16


Private setterFunction

• setterFunction: function | null = null

Defined in src/renderContext/animations/KyubAnimation.ts:22


Protected startValue

• startValue: T | null = null

Defined in src/renderContext/animations/KyubAnimation.ts:13


Protected targetValue

• targetValue: T | null = null

Defined in src/renderContext/animations/KyubAnimation.ts:14

Methods

Protected Abstract _interpolate

▸ _interpolate(percentage: number): T

Defined in src/renderContext/animations/KyubAnimation.ts:194

Return an interpolated value from this.startValue to this.targetValue based on the current percentage

Parameters:

Name Type
percentage number

Returns: T


Protected Abstract _setStartValue

▸ _setStartValue(value: T): void

Defined in src/renderContext/animations/KyubAnimation.ts:184

Check and save the value as this.startValue

Parameters:

Name Type
value T

Returns: void


Protected Abstract _setTargetValue

▸ _setTargetValue(value: T): void

Defined in src/renderContext/animations/KyubAnimation.ts:189

Check and save the value as this.targetValue

Parameters:

Name Type
value T

Returns: void


animate

▸ animate(timeDelta: number): boolean

Defined in src/renderContext/animations/KyubAnimation.ts:96

Animates the value on the target

Parameters:

Name Type Description
timeDelta number Time that has passed since last animate call (in ms)

Returns: boolean


cancel

▸ cancel(): void

Defined in src/renderContext/animations/KyubAnimation.ts:158

Finish this animation immediately so that it will not invoke its setter function anymore.

Returns: void


clone

▸ clone(): this

Defined in src/renderContext/animations/KyubAnimation.ts:169

Returns: this


delay

▸ delay(delay: number): this

Defined in src/renderContext/animations/KyubAnimation.ts:55

Sets the initial delay of the animation in ms (chainable)

Parameters:

Name Type
delay number

Returns: this


from

▸ from(value: T): this

Defined in src/renderContext/animations/KyubAnimation.ts:31

Sets the start value (chainable)

Parameters:

Name Type
value T

Returns: this


getPromise

▸ getPromise(): Promise‹void›

Defined in src/renderContext/animations/KyubAnimation.ts:165

Returns: Promise‹void›

A promise that is resolved once the animation finishes


getter

▸ getter(getterFunction: function): this

Defined in src/renderContext/animations/KyubAnimation.ts:63

Sets the function used to retrieve the current value (chainable)

Parameters:

▪ getterFunction: function

▸ (): T

Returns: this


in

▸ in(duration: number): this

Defined in src/renderContext/animations/KyubAnimation.ts:47

Sets the duration of the animation in ms (chainable)

Parameters:

Name Type
duration number

Returns: this


onStart

▸ onStart(onStartCallback: function): this

Defined in src/renderContext/animations/KyubAnimation.ts:87

Sets a callback that is called, right before the animation starts running (chainable)

Parameters:

▪ onStartCallback: function

▸ (): void

Returns: this


reset

▸ reset(): this

Defined in src/renderContext/animations/KyubAnimation.ts:147

Resets the state of this animation to the state before it started running (chainable). You can then rerun this animation from the start.

Returns: this


setter

▸ setter(setterFunction: function): this

Defined in src/renderContext/animations/KyubAnimation.ts:71

Sets the function used to set the new (animated) value (chainable)

Parameters:

▪ setterFunction: function

▸ (value: T, percentage?: number): void

Parameters:

Name Type
value T
percentage? number

Returns: this


to

▸ to(value: T): this

Defined in src/renderContext/animations/KyubAnimation.ts:39

Sets the target value (chainable)

Parameters:

Name Type
value T

Returns: this


usingInterpolation

▸ usingInterpolation(interpolationInstance: Interpolation): this

Defined in src/renderContext/animations/KyubAnimation.ts:79

Sets the interpolation method (chainable)

Parameters:

Name Type
interpolationInstance Interpolation

Returns: this