[feat]: Interpolate with a delay

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

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

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

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.

Description

template: request
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])}} />
Dominant language
TypeScript
Stars
29.3k
Forks
1.2k
Avg merge
3d 15h
Merged PRs (30d)
17

Getting set up

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.

More from pmndrs/react-spring

All issues in pmndrs/react-spring

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.