Skip to content

Commit ca39e75

Browse files
committed
feat: add "forceImmediate" global
Closes #668
1 parent 556ef9a commit ca39e75

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

packages/core/src/Controller.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { is } from 'shared'
22
import {
33
colorNames,
44
createStringInterpolator,
5+
forceImmediate,
56
frameLoop,
67
now,
78
} from 'shared/globals'
@@ -445,6 +446,10 @@ export class Controller<State extends Indexable = any> {
445446
}
446447
}
447448

449+
if (forceImmediate) {
450+
immediate = true
451+
}
452+
448453
if (reverse) {
449454
const { to } = props
450455
props.to = props.from

packages/shared/src/globals.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ export let colorNames: { [key: string]: number } = {}
3939

4040
export let defaultElement: any
4141

42+
export let forceImmediate = false
43+
4244
export let createAnimatedStyle: ((style: any) => any) | undefined
4345

4446
export let createAnimatedTransform: ((transform: any) => any) | undefined
@@ -65,6 +67,7 @@ export interface AnimatedGlobals {
6567
now?: typeof now
6668
frameLoop?: typeof frameLoop
6769
colorNames?: typeof colorNames
70+
forceImmediate?: typeof forceImmediate
6871
defaultElement?: typeof defaultElement
6972
applyAnimatedValues?: typeof applyAnimatedValues
7073
createStringInterpolator?: typeof createStringInterpolator
@@ -82,6 +85,7 @@ export const assign = (globals: AnimatedGlobals): AnimatedGlobals =>
8285
frameLoop,
8386
colorNames,
8487
defaultElement,
88+
forceImmediate,
8589
applyAnimatedValues,
8690
createStringInterpolator,
8791
createAnimatedInterpolation,
@@ -96,6 +100,7 @@ export const assign = (globals: AnimatedGlobals): AnimatedGlobals =>
96100
frameLoop,
97101
colorNames,
98102
defaultElement,
103+
forceImmediate,
99104
applyAnimatedValues,
100105
createStringInterpolator,
101106
createAnimatedInterpolation,

0 commit comments

Comments
 (0)