* Add a tween on one value.
(
identifier: string,
timeSource: TimeSource,
totalDuration: number,
easingIdentifier: string,
interpolate: Interpolation,
initialValue: float,
targetedValue: float,
setValue: (value: float) => void,
tweenInformation: TweenInformation,
onFinish?: (() => void) | null
)
| 239 | * Add a tween on one value. |
| 240 | */ |
| 241 | addSimpleTween( |
| 242 | identifier: string, |
| 243 | timeSource: TimeSource, |
| 244 | totalDuration: number, |
| 245 | easingIdentifier: string, |
| 246 | interpolate: Interpolation, |
| 247 | initialValue: float, |
| 248 | targetedValue: float, |
| 249 | setValue: (value: float) => void, |
| 250 | tweenInformation: TweenInformation, |
| 251 | onFinish?: (() => void) | null |
| 252 | ): void { |
| 253 | const easing = easingFunctions[easingIdentifier]; |
| 254 | if (!easing) return; |
| 255 | |
| 256 | // Remove any prior tween |
| 257 | this.removeTween(identifier); |
| 258 | |
| 259 | // Initialize the tween instance |
| 260 | const tween = new SimpleTweenInstance( |
| 261 | timeSource, |
| 262 | totalDuration, |
| 263 | easing, |
| 264 | easingIdentifier, |
| 265 | interpolate, |
| 266 | initialValue, |
| 267 | targetedValue, |
| 268 | setValue, |
| 269 | tweenInformation, |
| 270 | onFinish |
| 271 | ) as TweenInstance<number>; |
| 272 | this._tweens.set(identifier, tween); |
| 273 | this._addActiveTween(tween); |
| 274 | } |
| 275 | |
| 276 | /** |
| 277 | * Add a tween on several values. |
no test coverage detected