npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@omicrxn/mercury

v0.1.33

Published

Mercury is a Svelte animation library using AnimeJS under the hood. It simplifies complex animations with Svelte actions, provides layout and exit animations, and integrates seamlessly with Svelte features.

Downloads

174

Readme

Mercury

Mercury is a powerful Svelte animation library built on top of AnimeJS, offering an intuitive, streamlined way to animate DOM elements directly using Svelte actions. Mercury allows for seamless integration with existing Svelte features like transitions, actions, and motion, while eliminating the need for wrapper components. It also introduces layout animations and exit animations inspired by Framer Motion, all while keeping a clean and svelte-friendly syntax.

Features

  • Leverages AnimeJS for powerful animations
  • Supports layout animations
  • Provides exit animations
  • Simple, expressive Svelte syntax using use:mercury
  • No wrapper components, all animations applied directly to DOM elements
  • Works with all Svelte features for the DOM like transitions, actions, and motion, which also allows for direct binding to the element

Installation

npm install @omicrxn/mercury

Usage

<script>
	import { mercury,useExit } from '@omicrxn/mercury';
	let show = true;
</script>

<button on:click={() => (show = !show)}>Toggle Show</button>

{#if show}
	<div
		class="w-24 h-24 rounded-lg bg-blue-400 border border-blue-600"
		use:mercury={{
			opacity: 1,
			scale: [1, 2, 2, 1, 1],
			rotate: [0, 0, 180, 180, 0],
			borderRadius: ['8%', '8%', '50%', '50%', '8%'],
			duration: 3,
			ease: 'inOutSine',
			delay: 0.5,
			loop: true
		}}
		out:useExit={{
			opacity: 0,
			scale: 0,
			duration: 1
		}}
	></div>
{/if}

API

use:mercury

The primary action for applying animations to DOM elements. It accepts an object with animation parameters, similar to AnimeJS.

Example Parameters:

  • opacity: The opacity of the element
  • scale: A series of values to scale the element
  • rotate: Rotate the element around the Z-axis
  • borderRadius: A series of values to animate the border-radius
  • duration: The length of the animation in seconds
  • ease: The easing function for the animation
  • delay: The delay before the animation starts
  • loop: Specifies if the animation should loop

out:useExit

Action for defining exit animations when the element is removed from the DOM.

Example Parameters:

  • opacity: The opacity change during exit
  • scale: The scale during exit
  • duration: The duration of the exit animation

Acknowledgments

Mercury is built on the shoulders of giants. Special thanks to the creators and maintainers of Svelte, Anime.js, and special thanks to @Char2sGu for helping me integrate layout projections into the library.

License

MIT License