pmndrs / pmndrs/react-spring

[feat]: Interpolate with a delay

Open
#1,957 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

template: request
Dominant language
TypeScript
Stars
29.1k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

A clear and concise description of what the feature is

When using SpringValue interpolations, we should be able to interpolate with a delay.

Why should this feature be included?

For complex animations with multiple components and values being animated together, it's nice to be able to hook them all to one driving spring. It can be very difficult to use the existing interpolation API to stage animations, especially when they are asymmetrical (want a delay on animation in, no delay on animation out).

Please provide an example for how this would work
import {delay} from 'react-spring'

const spring = useSpring({ x: isActive ? 1 : 0})

// component with delay
<animated.div style={{opacity: spring.x.to(x => delay(x, 200))}} />

// component without delay
<animated.div style={{opacity: spring.x}} />

// component with existing api
<animated.div style={{opacity: spring.x.to([0, 0.5, 1), [0, 1, 1])}} />

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named in the issue. Start by locating the SpringValue interpolation API and reviewing the delay example; define the behavior for delayed interpolation, including asymmetric animation delays, then add coverage showing delayed and non-delayed values behave as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.