Download react-spring/packages/core/src/SpringPhase.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 908 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-spring/packages/core/src/SpringPhase.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-spring/packages/core/src/SpringPhase.ts
-
curl -L -o SpringPhase.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-spring/packages/core/src/SpringPhase.ts
908 Bytes
| /** The property symbol of the current animation phase. */ | |
| const $P = Symbol.for('SpringPhase') | |
| const HAS_ANIMATED = 1 | |
| const IS_ANIMATING = 2 | |
| const IS_PAUSED = 4 | |
| /** Returns true if the `target` has ever animated. */ | |
| export const hasAnimated = (target: any) => (target[$P] & HAS_ANIMATED) > 0 | |
| /** Returns true if the `target` is animating (even if paused). */ | |
| export const isAnimating = (target: any) => (target[$P] & IS_ANIMATING) > 0 | |
| /** Returns true if the `target` is paused (even if idle). */ | |
| export const isPaused = (target: any) => (target[$P] & IS_PAUSED) > 0 | |
| /** Set the active bit of the `target` phase. */ | |
| export const setActiveBit = (target: any, active: boolean) => | |
| active | |
| ? (target[$P] |= IS_ANIMATING | HAS_ANIMATED) | |
| : (target[$P] &= ~IS_ANIMATING) | |
| export const setPausedBit = (target: any, paused: boolean) => | |
| paused ? (target[$P] |= IS_PAUSED) : (target[$P] &= ~IS_PAUSED) | |