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

transition-style

v0.1.3

Published

just add water clip-path mask transitions

Downloads

2,970

Readme

46 pre-built transitions!

Hands on at Codepen or preview all @ transition.style

Basics

Import the CSS and set an attribute on some HTML: try on Codepen

<link rel="stylesheet" href="https://unpkg.com/transition-style">

<div transition-style="in:wipe:up">
  👍
</div>

Installation

NPM

  1. npm i transition-style
  2. import from CSS
@import "transition-style";
  1. or import from JS
import 'transition-style';

CDN

https://unpkg.com/transition-style

Individual Category Bundles

  • Circles https://unpkg.com/transition-style/transition.circles.min.css
  • Squares https://unpkg.com/transition-style/transition.squares.min.css
  • Polygons https://unpkg.com/transition-style/transition.polygons.min.css
  • Wipes https://unpkg.com/transition-style/transition.wipes.min.css

Import category bundles from NPM too import "transition-style/transition.circles.min.css"

👉 The Hackpack

https://unpkg.com/transition-style/transition.hackpack.min.css

More options, more control, smaller import
by importing only the custom properties and base styles:

  • compose custom transition combinations
  • create multi-part transitions
  • bring your own architecture with classes or CSS-in-JS or anything!

The Hackpack Sandbox

Custom properties ship with each .min.css as well

🔗 Bookmarklet

Try transition.css on almost any existing site! Just copy 📋 the following, create a new bookmark, and paste in the URL:

javascript:(function(){var a=document.createElement("link");a.rel="stylesheet";a.href="https://unpkg.com/transition-style";document.head.append(a);})();

You can now go to a website and click the bookmark to try it out! Animations automatically run when you manually add classes in dev tools, or run code like this in the console:

$('body').setAttribute('transition-style','in:circle:bottom-right')

Caveat: this bookmarklet doesn't work on websites that have a strict CSP set up.

Usage

After transition.css has been added to your project, add an attribute to an element and watch the magic:

<div transition-style="in:circle:bottom-right">
  A transitioned IN element
</div>

<div transition-style="out:wipe:down">
  A transitioned OUT element
</div>

if nothing is happening when using the attributes, it's likely transition.css has not loaded

Using @keyframes

Each bundle ships with the @keyframes declared, and you can use them as you see fit. You can use these to build your own animations or just hook into the presets in your own way:

.main--state-in {
  animation: wipe-in-left;
  animation-duration: 2s;
  animation-fill-mode: both;
}

Checkout the src to find the names of the @keyframe animations. They follow a pattern like the attributes, so you should be able to assume what they are with decent accuracy.

Using CSS Custom Properties

Each bundle ships with clearly named custom properties which contain the state and geometry needed to orchestrate custom transitions.

.overrides {
  --transition__duration: 1s;            /* default: 2.5s */
  --transition__easing: ease-in-out;     /* default: cubic-bezier(.25, 1, .30, 1) */
  --transition__delay: 1s;               /* default: 0 */
}

or target a specific transition and override it's defaults:

[transition="in:wipe:up"] {
  --transition__duration: 1s;
}

Custom

Go off the rails and build your own transitions with these variables. There's even the The Hackpack which is exclusively the custom props 🤘💀 Here's how you can compose a brand new transition from the custom property primitives:

@keyframes circle-swoop {
  from {
    clip-path: var(--circle-top-right-out);
  }
  to {
    clip-path: var(--circle-bottom-right-in);
  }
}

.--in-custom {
  --transition__duration: 1s;
  --transition__easing: ease-in-out;
  animation-name: circle-swoop;
}

Then, in the HTML:

<div transition-style class="--in-custom">
  A custom transitioned element
</div>

The only rule is that you must transition from the same type of shapes

At this point you're using Transition.css to it's maximum. You can reach a huge set of transitions by using the custom properties. Have fun!

Play

Play and experiment with this Codepen

Development

See the svelte branch.

Production

npm run bundle concurrently bundles and minifies.