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

aoejs

v2.0.6

Published

Animate On entrance (AOE) is a lightweight, dependency free, insanely fast scroll animation library built on top of Intersection Observer API

Downloads

153

Readme

aoejs

Elevate your web projects to the next level with aoejs – the ultimate animation companion.

aoejs empowers you to effortlessly add stunning animations to elements as they gracefully enter and exit the viewport. Crafted with simplicity and performance in mind, this lightweight package leverages the power of the Intersection Observer API for seamless integration and blazing-fast animations.

With customizable options and a collection of pre-built CSS3 animations, aoejs is your go-to solution for captivating user experiences. Say hello to dynamic web design with aoejs!

View the demo


Table of Contents

Install

Make sure to include aoe.css

<link rel="stylesheet" href="dist/aoe.css">

As npm package

npm i aoejs
import Aoe from 'aoejs';

const aoe = new Aoe();
aoe.init();

Options

You can set options during initialization:

aoe.init({
  attributes: {
    dataset: "data-aoe",
    delay: "data-aoe-delay",
    speed: "data-aoe-speed",
  },
  observerRoot: null,
  observeRootMargin: "0px",
  observerThreshold: [0, 0.5, 0.75, 1],
  intersectionRatio: 0.5,
  once: false,
  speed: 1500,
  delay: 0,
  timingFunction: 'linear',
});

| Property | Type | Description | Default | |---------------------------|-------------|---------------|---------| | once | Boolean | Defines if element should be animated every time it enters viewport. | false | | speed | Int | Defines animation speed on all elements - in ms | null | | delay | Int | Defines animation delay on all elements - in ms | null | | timing | String | Defines css timing function on all elements eg. ease-in | null | | intersectionRatio | Node | Tells how much of the target element needs to be visible within the root's intersection ratio in order to trigger animation | 0.5 | | observerRoot | Node | root | null/document | | observeRootMargin | string | rootMargin | 0px | | observerThreshold | number/array | threshold | [0, 0.5, 1] | | attributes.dataset | String | You can change the data-aoe="" into data-custom="" | null | | attributes.delay | String | You can change the data-aoe-delay="" into custom-property-delay="" | null | | attributes.speed | String | You can change the data-aoe-speed="" into custom-property-speed="" | null |

Methods

Set callback for when element enters viewport

const aoe = new Aoe();
aoe.init();

aoe.onEnter((entry) => {
  console.log("Element entered viewport:", entry.target);
});

Set callback for when element leaves viewport

const aoe = new Aoe();
aoe.init();

aoe.onLeave((entry) => {
  console.log("Element left viewport:", entry.target);
});

Disconnect all observers

const aoe = new Aoe();
aoe.init();

aoe.disconnectObservers();

Usage

Add data-aoe attribute to your desired HTML elements.

<div data-aoe="popIn"></div>

With AOE you can easily affect animation speed and delay on individual items.

Simply add speed/delay into data-aoe attribute (in miliseconds):

<div data-aoe="popIn:1000:2000"></div>
<div data-aoe="popIn:duration:delay"></div>
<!-- or separately -->
<div data-aoe="popIn" data-aoe-delay="300" data-aoe-speed="100"></div>

Animations

AOE ships with many fancy CSS3 animations

  • swoopInTop
  • swoopInBottom
  • swoopInLeft
  • swoopInRight
  • popIn
  • popInTop
  • popInBottom
  • popInLeft
  • popInRight
  • hitLeft
  • hitRight
  • fadeIn
  • fadeInTop
  • fadeInBottom
  • fadeInLeft
  • fadeInRight
  • jumpInLeft
  • jumpInRight
  • driveInTop
  • driveInBottom
  • driveInLeft
  • driveInRight
  • ball
  • pull
  • pullLeft
  • pullRight
  • unfold
  • spinIn
  • flipInX
  • flipInY
  • rollIn

With AOE you can easily add your own, custom animations.

<div data-aoe="CustomAnimation"></div>
@keyframes CustomAnimation {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

.CustomAnimation {
    animation-name: CustomAnimation;
}

Note: You probably gonna need overflow-x: hidden on body / main

Note: Intersection Observer API does not work very old browsers! Make sure to:

Aoe should fallback to simple fadeIn animation if browser doesn't support it.

License

Created by Michał Gwóźdź. Released under the ISC License.

Author website: thesigner.dev