Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add steps easing function #4298

Merged
merged 5 commits into from
Mar 30, 2023
Merged

Add steps easing function #4298

merged 5 commits into from
Mar 30, 2023

Conversation

alabsi91
Copy link
Contributor

Description

This pull request adds a new steps easing function to React Native Reanimated. The steps function allows for animations to jump between discrete values, similar to the CSS steps() function.

The steps function takes two arguments: n, which specifies the number of steps in the animation, and start, which specifies whether the animation should start at the beginning (start) or end (end) of the step.

Usage

rotate.value = withTiming(360, { duration: 60 * 1000, easing: Easing.steps(60, false) })
  • This function has been tested and is confirmed to be working correctly on both the Android, Expo, and Web platforms.

Example

@piaskowyk
Copy link
Member

Hey @alabsi91 Thanks for your PR! I really like your idea 馃槏

@piaskowyk piaskowyk added this pull request to the merge queue Mar 30, 2023
Merged via the queue into software-mansion:main with commit aa912f3 Mar 30, 2023
fluiddot pushed a commit to wordpress-mobile/react-native-reanimated that referenced this pull request Jun 5, 2023
### Description
This pull request adds a new `steps` easing function to React Native
Reanimated. The steps function allows for animations to jump between
discrete values, similar to the CSS `steps()` function.

The steps function takes two arguments: `n`, which specifies the number
of steps in the animation, and `start`, which specifies whether the
animation should start at the beginning (start) or end (end) of the
step.

### Usage
```js
rotate.value = withTiming(360, { duration: 60 * 1000, easing: Easing.steps(60, false) })
```

- This function has been tested and is confirmed to be working correctly
on both the `Android`, `Expo`, and `Web` platforms.

### Example
- 馃憠 [expo snack
example](https://snack.expo.dev/@alabsi91/react-native-reanimated-steps-easing-function-example)

---------

Co-authored-by: Krzysztof Piaskowy <krzysztof.piaskowy@swmansion.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants