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

ngx-bootjack-bounce

v0.1.0

Published

This is a collection of common UI animations for modern Angular applications.

Downloads

20

Readme

Bootjack Bounce

This is a collection of common UI animations for modern Angular applications.

Currenlty there's not much here, but I plan to add a lot more in the future. My goal is to keep this library slim and only add animations that are common UI interactions. They are intended for use with things like menu panels, modals, view transitions and other similar patterns that you're likely to run into in your day to day work.

If you'd like to request an animation, please do!

Installation

npm i ngx-bootjack-bounce

Usage

Before you can use the animations in this library, you'll need to enable the animations module in your application. Learn how to do this here.

After every thing is installed, the animations in this library can be used either as state-based or enter/leave animations.

State-based Animation Usage

If the elements you're animating are always included within the DOM, you'll want to use a state-based animation.

Let's use a "slide" animation for an example. In order to use this animation you'll need to import the btjSlideState animation and include it the animations array for your component. You'll also need a boolean property to trigger the "true" and "false" states.

component.ts

import { btjSlideState } from 'ngx-bootjack-bounce';

@Component({
    ...
    animations: [
        btjSlideState
    ]
})
export class Component {
    protected isVisible = signal(false);
}

component.html

<div [@btjSlideState]="visible()">
    ...
</div>
<button (click)="isVisible.set(!isVisible())">Animate</button>

By default the animation will slide in from the left. If you want to change this, you can use animation params.

So to flip and animate in from the right, you can provide a "startX" param. This will be the X translation value when the animation starts.

component.html

<div [@btjSlideState]="{
        value: visible(),
        params {
            startX: 100%
        }
    }">
    ...
</div>

If you want to slide in a vertical direction, you can provide a "startY" param. This will be the Y translation value when the animation starts.

component.html

<div [@btjSlideState]="{
        value: visible(),
        params {
            startY: -100%
        }
    }">
    ...
</div>

Additionally, you can set the starting opacity and scale.

component.html

<div [@btjSlideState]="{
        value: visible(),
        params {
            startY: -100%,
            startOpacity: 0,
            startScale: 0.7
        }
    }">
    ...
</div>

Enter/Leave Animation Usage

If the elements you're animating are conditionally added or removed from the DOM, you'll want to use the enter/leave version of the animation.

Again let's use a "slide" animation to demonstrate. In order to use this animation you'll need to import the btjSlideEnterLeave animation and include it the animations array for your component.

component.ts

import { btjSlideEnterLeave } from 'ngx-bootjack-bounce';

@Component({
    ...
    animations: [
        btjSlideEnterLeave
    ]
})
export class Component {
    protected isVisible = signal(false);
}

component.html

@if (visible()) {
    <div @btjSlideEnterLeave>
        ...
    </div>
}
<button (click)="visible.set(!visible())">{{ visible() ? 'Hide' : 'Show' }}</button>

By default the animation will slide in from the left. If you want to change this, you can use animation params.

The available params are:

  • startX
  • startY
  • startScale
  • startOpacity

And you can see how to use them above.

Customizing the Animation Duration

If you don't like the default duration for the animation, you can add your own with animation params using the "duration" param.

component.html

<div [@btjSlideState]="{
        value: visible(),
        params {
            duration: '3s'
        }
    }">
    ...
</div>