[Request] Be able to set spring config per value

未关闭
#1,803 2 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
28/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
react, typescript
领域
frontend

调研方向

首先,在链接的 CodeSandbox 中复现按值配置的需求,并阅读现有 useSpring API 的行为。定义如何在同一个 spring 中使用 opacity 和 x 的独立配置,并验证一个 API 能否使用各自的设置控制这两个值。

由索引模型根据 Issue 内容生成。

描述

kind: request

🚀 Feature Proposal

The idea is to be able to set a spring config per value in a single useSpring.

Motivation + Example

I like to use a single useSpring per component where possible and when doing more complex motion design I need individual values to have their own spring config. This especially becomes important when the spring config is modified depending on the state of the app and user interactions. For example, I may have an opacity value that I want to always transition with a linear duration but an x value that toggles from being stiff to wobbly depending on its direction of motion (open or close).

Currently I have to make two springs to handle this case and then use their apis in sync.

Note: I thought I could use a useSpringRef for a single api to control both springs but I couldn't figure out how to change the config for individual springs this way.

Here is a sandbox: https://codesandbox.io/s/dreamy-turing-3kpom?file=/src/App.js

主要语言
TypeScript
星标
29.3k
派生
1.2k
平均合并
3 天 15 小时
30 天内合并 PR
17

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

pmndrs/react-spring 的其他 Issue

查看 pmndrs/react-spring 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。