Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rc-motion

Package Overview
Dependencies
Maintainers
4
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-motion

React lifecycle controlled motion library

  • 2.9.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
4
Weekly downloads
 
Created

What is rc-motion?

The rc-motion npm package is a React component library designed to handle animations and transitions in a React application. It provides a simple and powerful way to implement various animations, including entering, leaving, and switching animations with customizable options for timing, easing, and more.

What are rc-motion's main functionalities?

Basic Animation

This code demonstrates how to use rc-motion to create a basic fade-in animation. The `CSSMotion` component is used with the `visible` prop set to true and a `motionName` provided to define the animation type. The children function renders the animated element with the appropriate style and className applied.

{"import React from 'react'; import CSSMotion from 'rc-motion'; function FadeInExample() { return ( <CSSMotion visible={true} motionName='fade'> {({ style, className }) => ( <div style={style} className={className}>Fade In Animation</div> )} </CSSMotion> ); } export default FadeInExample;"}

Custom Animation

This example shows how to create a custom slide animation using rc-motion. The `CSSMotion` component is configured with custom functions for `onAppearStart` and `onAppearActive` to control the animation's start and active states, respectively. This allows for more complex animations beyond predefined ones.

{"import React from 'react'; import CSSMotion from 'rc-motion'; function SlideAnimationExample() { return ( <CSSMotion visible={true} motionName='slide' motionAppear={true} onAppearStart={() => ({ height: 0 })} onAppearActive={() => ({ height: 'auto' })} > {({ style, className }) => ( <div style={style} className={className}>Slide Animation</div> )} </CSSMotion> ); } export default SlideAnimationExample;"}

Other packages similar to rc-motion

Keywords

FAQs

Package last updated on 17 Jun 2024

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc