How to use the @react-spring/animated.isAnimationValue function in @react-spring/animated

To help you get started, we’ve selected a few @react-spring/animated examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github react-spring / react-spring / packages / core / src / FrameLoop.ts View on Github external
advance(dt: number, spring: SpringValue) {
    let idle = true
    let changed = false

    const anim = spring.animation!
    const parent = isFluidValue(anim.to) && anim.to
    const payload = isAnimationValue(parent) && parent.node!.getPayload()

    anim.values.forEach((node, i) => {
      if (node.done) return

      let to: number = payload
        ? payload[i].lastPosition
        : parent
        ? toArray(parent.get())[i]
        : anim.toValues![i]

      // Parent springs must finish before their children can.
      const canFinish = !payload || payload[i].done

      const { config } = anim

      // Loose springs never move.