Socket
Socket
Sign inDemoInstall

@motionone/dom

Package Overview
Dependencies
Maintainers
2
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@motionone/dom

A tiny, performant animation library for the DOM


Version published
Weekly downloads
1.3M
increased by9.22%
Maintainers
2
Weekly downloads
 
Created

What is @motionone/dom?

@motionone/dom is a powerful and flexible library for creating animations and transitions in web applications. It provides a simple API to animate DOM elements with various effects, including transforms, opacity changes, and more. The library is designed to be performant and easy to use, making it a great choice for adding dynamic visual effects to your web projects.

What are @motionone/dom's main functionalities?

Basic Animation

This feature allows you to animate basic properties of DOM elements. In this example, the element with the class 'box' is animated to move 100 pixels to the right over a duration of 1 second.

import { animate } from '@motionone/dom';

animate('.box', { transform: 'translateX(100px)' }, { duration: 1 });

Keyframe Animations

This feature allows you to create more complex animations using keyframes. In this example, the element with the class 'box' moves to the right and then back to its original position over a duration of 2 seconds.

import { animate } from '@motionone/dom';

animate('.box', [
  { transform: 'translateX(0px)' },
  { transform: 'translateX(100px)' },
  { transform: 'translateX(0px)' }
], { duration: 2 });

Staggered Animations

This feature allows you to create staggered animations for multiple elements. In this example, elements with the class 'box' will fade in one after another with a delay of 0.1 seconds between each.

import { animate, stagger } from '@motionone/dom';

animate('.box', { opacity: [0, 1] }, { delay: stagger(0.1) });

Scroll-based Animations

This feature allows you to trigger animations based on the scroll position. In this example, elements with the class 'box' will fade in when they come into view.

import { animate, inView } from '@motionone/dom';

inView('.box', () => {
  animate('.box', { opacity: [0, 1] });
});

Other packages similar to @motionone/dom

FAQs

Package last updated on 01 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