File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 1+ /** The property symbol of the current animation phase. */
2+ const $P = Symbol . for ( 'SpringPhase' )
3+
4+ const HAS_ANIMATED = 1
5+ const IS_ANIMATING = 2
6+ const IS_PAUSED = 4
7+
8+ /** Returns true if the `target` has ever animated. */
9+ export const hasAnimated = ( target : any ) => ( target [ $P ] & HAS_ANIMATED ) > 0
10+
11+ /** Returns true if the `target` is animating (even if paused). */
12+ export const isAnimating = ( target : any ) => ( target [ $P ] & IS_ANIMATING ) > 0
13+
14+ /** Returns true if the `target` is paused (even if idle). */
15+ export const isPaused = ( target : any ) => ( target [ $P ] & IS_PAUSED ) > 0
16+
17+ /** Set the active bit of the `target` phase. */
18+ export const setActiveBit = ( target : any , active : boolean ) =>
19+ active
20+ ? ( target [ $P ] |= IS_ANIMATING | HAS_ANIMATED )
21+ : ( target [ $P ] &= ~ IS_ANIMATING )
22+
23+ export const setPausedBit = ( target : any , paused : boolean ) =>
24+ paused ? ( target [ $P ] |= IS_PAUSED ) : ( target [ $P ] &= ~ IS_PAUSED )
You can’t perform that action at this time.
0 commit comments