Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
react-native-easing-keyframes
Advanced tools
Create CSS keyframe-based animations in React Native
Create CSS keyframe-based animations in React Native
yarn add react-native-easing-keyframes
or
npm install react-native-easing-keyframes
Usually in timing animations, the easing function is applied to the entire duration of the animation. With the keyframes
helper from this library, you can control what easing function to use in each keyframe during the animation.
import keyframes from 'react-native-easing-keyframes'
const easeInOut = Easing.bezier(0.42, 0.0, 0.58, 1.0)
const value = new Animated.Value(0)
Animated.timing(value, {
duration: 1200,
toValue: 100,
easing: keyframes({ easing: easeInOut, keyframes: [0, 50, 100] }),
useNativeDriver: true,
})
In the example above, keyframes
will apply the easing function you want to use (easeInOut
) to each keyframe, so easeInOut
will be applied twice, from 0 to 50 and from 50 to 100.
You can also target a specific keyframe and apply a different easing function to it.
Animated.timing(value, {
duration: 1200,
toValue: 100,
easing: keyframes({
easing: easeInOut,
keyframes: [0, 50, 100],
easingsByKeyframe: { 50: Easing.linear },
}),
useNativeDriver: true,
})
(config: Config) => EasingFunction
This function applies an easing function to each keyframe based on a config.
An object that contains:
number[]
And array of keyframes used in the animation.
This array must have at least 3 items. If you're animating from 0
to 100
then the first one should be 0
and the last one should be 100
.
(value: number) => number
| default to Easing.inOut(Easing.ease)
The default easing function that will be used in all keyframes.
{ [key: number]: EasingFunction }
| defaults to {}
You can specify the easing function you want to use for an individual keyframe. If no easing function
is specified, the value from easing
will be used.
To run the example project, follow these steps:
yarn
cd example
yarn && yarn start
FAQs
Create CSS keyframe-based animations in React Native
We found that react-native-easing-keyframes demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.