
Security News
TC39 Advances 11 Proposals for Math Precision, Binary APIs, and More
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
github.com/bringking/react-web-animation
react-web-animation is a set of React components that expose the Web Animations API in a declarative way.
Check out how you can use it here - http://react-web-animation.surge.sh
Why use this over other animation libraries for React? react-web-animation uses the Web Animations API polyfill so eventually it will use the native browser implementation and not depend on any third-party animation frameworks or CSS. Chrome has the greatest support for these today and if you view the source on the demos, you can see it isn't using CSS at all!
Want to know more about the Web Animations API? Here are some great resources.
react-web-animation requires the following peer dependencies to be installed
npm install react
npm install react-dom
npm install prop-types
npm install react-web-animation
react-web-animation has a runtime dependency on the next
version Web Animations API polyfill.
The easiest way to get this is to grab it from cdnjs
and include it in your application.
<script src="https://cdnjs.cloudflare.com/ajax/libs/web-animations/2.2.1/web-animations-next.min.js"></script>
<Animated.[componentName]>
e.g. <Animated.div>
and control play state (play, pause, stop, reverse)<Animation>
and control play state (play, pause, stop, reverse)<AnimationGroup>
, controlling them with one timeline<AnimationSequence>
, controlling them with one timelineCreating an animated element is as simple using an <Animated.[elementName]>
component and supplying keyframes
and a timing
config.
import React, { Component } from 'react';
import { Animated } from 'react-web-animation';
export default class Basic extends Component {
getKeyFrames() {
return [
{ transform: 'scale(1)', opacity: 1, offset: 0 },
{ transform: 'scale(.5)', opacity: 0.5, offset: 0.3 },
{ transform: 'scale(.667)', opacity: 0.667, offset: 0.7875 },
{ transform: 'scale(.6)', opacity: 0.6, offset: 1 }
];
}
getTiming( duration ) {
return {
duration,
easing: 'ease-in-out',
delay: 0,
iterations: 2,
direction: 'alternate',
fill: 'forwards'
};
}
render() {
return
<Animated.div keyframes={this.getKeyFrames()}
timing={this.getTiming(2500)}>
Web Animations API Rocks
</Animated.div>;
}
}
For more advanced usage, head over to the source documentation or check out the http://react-web-animation.surge.sh
MIT
FAQs
Unknown package
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
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.