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

@animotion/motion

v0.0.6

Published

Svelte animation library

Downloads

241

Readme

Motion

https://github.com/animotionjs/motion/assets/38083522/7cd87b1b-016f-46d3-b2c9-67e849d4559f

What Is Motion?

Motion is a simple Svelte animation library. Instead of being limited to animating CSS properties using a JavaScript animation library, or the Web Animations API, it uses values that change over time, to animate any property.

Installation

npm i @animotion/motion

Methods

  • animate is an onMount wrapper, but you can use any async function to define the animation
  • signal is the value over time which can be a single value, such as signal(0), or an object signal({ count: 0 })
  • all is a helper function used to play animations at the same time (you can use await in front of it)
  • reset is a helper function to reset the animation to its default values

Usage

  • To start an animation use the await keyword
  • Use to on a signal to animate values, and sfx to play sounds
  • to and sfx are chainable
  • signal and to accept an options object for duration, delay, and easing

Example

Open in SvelteLab

You can try the example in SvelteLab.

<script lang="ts">
	import { animate, signal, all } from '@animotion/motion'
	import { formatNumber } from '$lib/utils'

	const sfx = {
		transition: 'sfx/transition.mp3',
		tally: 'sfx/tally.mp3',
	}

	const svg = signal({ x: -2, y: -2, w: 24, h: 24 })
	const circle = signal({ x: 2.5, y: 2.5, r: 1.5, fill: '#00ffff' })
	const text = signal({ count: 0, opacity: 0 })

	animate(async () => {
		await svg.sfx(sfx.transition).to({ x: 0, y: 0, w: 10, h: 10 })

		all(
			circle.sfx(sfx.transition).to({ x: 10, y: 10, r: 3, fill: '#ffff00' }),
			svg.to({ x: 5, y: 5 })
		)

		await text
			.to({ opacity: 1 }, { duration: 300 })
			.sfx(sfx.tally)
			.to({ count: 10_000 }, { duration: 600 })
	})
</script>

<svg viewBox="{$svg.x} {$svg.y} {$svg.w} {$svg.h}">
	<circle cx={$circle.x} cy={$circle.y} r={$circle.r} fill={$circle.fill} />

	<text
		x={$circle.x}
		y={$circle.y}
		font-size={$circle.r * 0.4}
		opacity={$text.opacity}
		text-anchor="middle"
		dominant-baseline="middle"
		fill="#000"
	>
		{formatNumber($text.count)}
	</text>
</svg>