Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@motionone/dom
Advanced tools
@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.
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] });
});
Anime.js is a lightweight JavaScript animation library with a simple, yet powerful API. It supports various types of animations, including CSS properties, SVG, DOM attributes, and JavaScript objects. Compared to @motionone/dom, Anime.js offers a broader range of animation capabilities but may have a steeper learning curve.
GSAP (GreenSock Animation Platform) is a robust and highly performant animation library. It provides a wide range of features for animating DOM elements, including complex timelines, easing functions, and more. GSAP is known for its performance and flexibility, making it a popular choice for professional-grade animations. Compared to @motionone/dom, GSAP offers more advanced features and greater control over animations.
Framer Motion is a popular animation library for React applications. It provides a declarative API for creating animations and transitions, making it easy to integrate with React components. Framer Motion is designed to work seamlessly with React, offering features like layout animations and gesture-based interactions. Compared to @motionone/dom, Framer Motion is more specialized for React and offers a more integrated experience for React developers.
@motionone/dom
DOM bindings for Motion One.
Full docs for Motion One available at motion.dev.
FAQs
A tiny, performant animation library for the DOM
The npm package @motionone/dom receives a total of 0 weekly downloads. As such, @motionone/dom popularity was classified as not popular.
We found that @motionone/dom demonstrated a healthy version release cadence and project activity because the last version was released less than 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
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.