Socket
Socket
Sign inDemoInstall

@react-spring/animated

Package Overview
Dependencies
3
Maintainers
1
Versions
127
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-spring/animated


Version published
Weekly downloads
1.4M
decreased by-17.77%
Maintainers
1
Created
Weekly downloads
 

Package description

What is @react-spring/animated?

@react-spring/animated is a library that provides a set of tools for creating animations in React applications. It is part of the React Spring ecosystem and focuses on providing a flexible and performant way to animate components and values.

What are @react-spring/animated's main functionalities?

Basic Animation

This feature allows you to create basic animations by interpolating between two states. In this example, a div element fades in from opacity 0 to opacity 1.

import { animated, useSpring } from '@react-spring/animated';

function BasicAnimation() {
  const props = useSpring({ to: { opacity: 1 }, from: { opacity: 0 } });
  return <animated.div style={props}>I will fade in</animated.div>;
}

Keyframe Animation

This feature allows you to create keyframe animations by chaining multiple states. In this example, a div element moves 100px to the right and then back to its original position.

import { animated, useSpring } from '@react-spring/animated';

function KeyframeAnimation() {
  const props = useSpring({
    from: { transform: 'translate3d(0,0,0)' },
    to: async (next) => {
      await next({ transform: 'translate3d(100px,0,0)' });
      await next({ transform: 'translate3d(0,0,0)' });
    },
  });
  return <animated.div style={props}>I will move</animated.div>;
}

Spring-based Animation

This feature allows you to create spring-based animations with custom configurations. In this example, a number animates from 0 to 1 over a duration of 1000 milliseconds.

import { animated, useSpring } from '@react-spring/animated';

function SpringAnimation() {
  const props = useSpring({
    to: { number: 1 },
    from: { number: 0 },
    config: { duration: 1000 },
  });
  return <animated.div>{props.number.to(n => n.toFixed(2))}</animated.div>;
}

Other packages similar to @react-spring/animated

Readme

Source

@react-spring/animated

Fork of animated

Keywords

FAQs

Last updated on 25 Feb 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc