svelte-animations
Svelte Magic UI, Svelte Aceternity UI, Svelte Components build using Tailwind CSS & Framer Motion
Top Related Projects
A modern animation library for React and JavaScript
🍿 A cross-browser library of CSS animations. As easy to use as an easy thing.
JavaScript animation engine
GSAP (GreenSock Animation Platform), a JavaScript animation library for the modern web
Animate on scroll library
A zero-config, drop-in animation utility that adds smooth transitions to your web app. You can use it with React, Vue, or any other JavaScript application.
Quick Overview
SikandarJODD/svelte-animations is a GitHub repository containing a collection of pre-built animations for Svelte applications. It provides easy-to-use, customizable animation components that can be quickly integrated into Svelte projects, enhancing the user interface with smooth and attractive transitions and effects.
Pros
- Ready-to-use animation components for Svelte
- Easy integration into existing Svelte projects
- Customizable animation properties
- Lightweight and performance-optimized
Cons
- Limited documentation and examples
- May not cover all possible animation scenarios
- Potential compatibility issues with older Svelte versions
- Lack of regular updates and maintenance
Code Examples
- Fade animation:
<script>
import { fade } from 'svelte-animations';
</script>
<div use:fade={{ duration: 300, delay: 100 }}>
This content will fade in and out
</div>
- Slide animation:
<script>
import { slide } from 'svelte-animations';
</script>
<div use:slide={{ axis: 'x', duration: 500 }}>
This content will slide in and out horizontally
</div>
- Scale animation:
<script>
import { scale } from 'svelte-animations';
</script>
<div use:scale={{ start: 0.5, end: 1, duration: 400 }}>
This content will scale up and down
</div>
Getting Started
To use svelte-animations in your Svelte project:
-
Install the package:
npm install svelte-animations
-
Import and use the desired animation in your Svelte component:
<script> import { fade } from 'svelte-animations'; </script> <div use:fade> Animated content </div>
-
Customize animation properties as needed:
<div use:fade={{ duration: 500, delay: 200 }}> Customized animated content </div>
Competitor Comparisons
A modern animation library for React and JavaScript
Pros of motion
- More comprehensive animation library with support for multiple frameworks
- Larger community and more frequent updates
- Extensive documentation and examples
Cons of motion
- Steeper learning curve due to more complex API
- Larger bundle size, which may impact performance
Code Comparison
svelte-animations:
import { fade } from 'svelte/transition';
<div transition:fade>
Fading content
</div>
motion:
import { motion } from "framer-motion"
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
>
Fading content
</motion.div>
Summary
motion offers a more robust and versatile animation solution, supporting multiple frameworks and providing extensive documentation. However, it comes with a steeper learning curve and larger bundle size. svelte-animations, while more limited in scope, provides a simpler API specifically tailored for Svelte applications.
The code comparison demonstrates the difference in syntax and complexity between the two libraries. svelte-animations leverages Svelte's built-in transition system, resulting in more concise code. motion, on the other hand, offers more granular control over animations but requires more verbose syntax.
Ultimately, the choice between these libraries depends on the specific needs of the project, the desired level of animation complexity, and the target framework.
🍿 A cross-browser library of CSS animations. As easy to use as an easy thing.
Pros of animate.css
- Widely adopted and well-established CSS animation library
- Framework-agnostic, can be used with any web project
- Extensive collection of pre-built animations
Cons of animate.css
- Larger file size, potentially impacting page load times
- Less customizable without modifying the source CSS
- Not specifically optimized for Svelte applications
Code Comparison
animate.css:
.animate__animated {
animation-duration: 1s;
animation-fill-mode: both;
}
.animate__bounce {
animation-name: bounce;
}
svelte-animations:
<script>
import { fade } from 'svelte/transition';
</script>
<div transition:fade>Fading content</div>
The animate.css example shows how to apply a pre-defined animation class, while svelte-animations leverages Svelte's built-in transition system for more dynamic, component-specific animations.
svelte-animations is tailored for Svelte projects, offering a more integrated and performant solution for Svelte developers. It utilizes Svelte's reactive nature and transition API, allowing for smoother, more efficient animations that are tightly coupled with the component lifecycle.
animate.css, on the other hand, provides a broader range of ready-to-use animations that can be easily applied to any HTML element, regardless of the framework or library being used. This makes it a versatile choice for projects that require quick implementation of common animation effects across different platforms.
JavaScript animation engine
Pros of anime
- More versatile, can be used with any JavaScript framework or vanilla JS
- Larger community and ecosystem, with more examples and resources available
- More comprehensive animation features, including SVG morphing and timeline control
Cons of anime
- Larger file size and potentially higher performance overhead
- Not specifically optimized for Svelte integration
- Steeper learning curve for beginners due to more complex API
Code Comparison
anime:
anime({
targets: '.element',
translateX: 250,
rotate: '1turn',
duration: 800,
easing: 'easeInOutQuad'
});
svelte-animations:
<script>
import { fade } from 'svelte-animations';
</script>
<div use:fade={{ duration: 800 }}>
Animated content
</div>
Key Differences
- anime is a standalone JavaScript animation library, while svelte-animations is specifically designed for Svelte
- svelte-animations leverages Svelte's reactive system and action directives for easier integration
- anime offers more granular control over animations, while svelte-animations focuses on simplicity and ease of use within Svelte components
Use Cases
- Choose anime for complex, cross-framework animations or when working outside of Svelte
- Opt for svelte-animations when building Svelte applications and prioritizing simplicity and framework-specific optimizations
GSAP (GreenSock Animation Platform), a JavaScript animation library for the modern web
Pros of GSAP
- More mature and feature-rich animation library with extensive documentation
- Cross-browser compatibility and performance optimization
- Supports complex animation sequences and timelines
Cons of GSAP
- Larger file size and potential performance overhead for simpler animations
- Steeper learning curve for beginners
- Not specifically designed for Svelte, requiring additional setup
Code Comparison
GSAP:
import { gsap } from "gsap";
gsap.to(".box", { duration: 1, x: 100, y: 100, rotation: 360 });
svelte-animations:
<script>
import { fade } from 'svelte-animations';
</script>
<div use:fade={{ duration: 1000 }}>Fading element</div>
Summary
GSAP is a powerful, versatile animation library suitable for complex animations across various frameworks. svelte-animations, while more limited in scope, offers a simpler, Svelte-specific solution for basic animations. GSAP provides more control and features but may be overkill for simple projects, whereas svelte-animations integrates seamlessly with Svelte's reactive paradigm.
Animate on scroll library
Pros of aos
- Framework-agnostic, works with any JavaScript project
- Extensive documentation and examples
- Larger community and more widespread adoption
Cons of aos
- Not specifically optimized for Svelte applications
- Potentially heavier and less performant for Svelte-specific use cases
Code Comparison
aos:
AOS.init({
duration: 1000,
easing: 'ease-in-out',
once: true,
offset: 200,
});
svelte-animations:
<script>
import { fade } from 'svelte/transition';
import { inview } from 'svelte-inview';
</script>
<div use:inview on:enter={handleEnter}>
{#if visible}
<div transition:fade>Animated content</div>
{/if}
</div>
Summary
aos is a versatile animation library that works across various frameworks, offering extensive documentation and community support. However, svelte-animations is tailored specifically for Svelte, potentially providing better integration and performance for Svelte projects. The code comparison shows that aos uses a global initialization approach, while svelte-animations leverages Svelte's built-in transition system and custom directives for a more idiomatic implementation.
A zero-config, drop-in animation utility that adds smooth transitions to your web app. You can use it with React, Vue, or any other JavaScript application.
Pros of auto-animate
- Framework-agnostic, works with various JavaScript libraries and frameworks
- Automatic animation of list changes without explicit configuration
- Supports multiple animation types (fade, slide, etc.) out of the box
Cons of auto-animate
- Less customization options for specific Svelte-based animations
- May have a slightly larger footprint due to its framework-agnostic nature
- Requires manual integration with Svelte components
Code Comparison
svelte-animations:
<script>
import { fade } from 'svelte-animations';
</script>
<div use:fade>Animated content</div>
auto-animate:
import { autoAnimate } from '@formkit/auto-animate'
onMount(() => {
autoAnimate(parentElement)
})
Summary
svelte-animations is tailored specifically for Svelte, offering seamless integration and Svelte-specific optimizations. It provides a range of pre-built animations that can be easily applied to Svelte components.
auto-animate, on the other hand, is a more versatile solution that can be used across different frameworks. It excels in automatically animating list changes without requiring explicit configuration for each item. However, it may require more setup when used with Svelte and might not offer the same level of Svelte-specific optimizations as svelte-animations.
The choice between the two depends on whether you need a Svelte-specific solution or a more framework-agnostic approach to animations in your project.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Svelte Components
Build using Tailwind CSS and Svelte motion.
Important Note
- Components which includes svelte-motion library are not supported in Svelte 5.
- Only components which are build using Tailwind CSS and Svelte are supported in Svelte 5.
- Right now i am trying to convert each component to Svelte 5 using Motion-Start
Svelte 5 Support Components Count
UI Libs | Count | description |
---|---|---|
Aceternity UI | 13 | build using svelte and tailwind css - you can easily migrate it to svelte 5 |
Indie UI | All components | build using svelte and tailwind css - you can easily migrate it to svelte 5 |
Luxe UI | 20 | build using svelte and tailwind css - you can easily migrate it to svelte 5 |
Magic UI | 20+ | build using svelte and tailwind css - you can easily migrate it to svelte 5 |
- I will be converting the rest of the component to Svelte 5, so you can use it in your project in the coming days...
- I will be using Motion-Start Lib whcih is same as Svelte Motion but it works in Svelte 5 too.
New Templates
Minimalist Developer Portfolio
- GitHub : Repo
Start-up Landing Page
- GitHub : Repo
New Aceternity UI Components
Name | Preview | Section |
---|---|---|
Placeholders and vanish Input | Visit | Aceternity UI |
New Components
Name | Preview | Section |
---|---|---|
Colorful Text | Visit | Magic UI |
Scratch To Reveal | Visit | Magic UI |
Ripple Button | Visit | Magic UI |
Interactive Hover Button | Visit | Magic UI |
Feedback
If you have any feedback, please reach out at Twitter
Credits
Components are inspired from the above mentioned websites. Thankyou everyone for building such amazing components.
Support
Top Related Projects
A modern animation library for React and JavaScript
🍿 A cross-browser library of CSS animations. As easy to use as an easy thing.
JavaScript animation engine
GSAP (GreenSock Animation Platform), a JavaScript animation library for the modern web
Animate on scroll library
A zero-config, drop-in animation utility that adds smooth transitions to your web app. You can use it with React, Vue, or any other JavaScript application.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot