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

rfx-scroll-animation

v3.5.4

Published

Animate your page elements on scroll

Downloads

41

Readme

RfxScrollAnimation

Animate your page elements on scroll

Features

  • Animate your component on scroll
  • Multiple animations
  • Apply directly on your element
  • Add your own custom animation
  • Best performance with will-change

Installation

Install the npm package:

npm install rfx-scroll-animation

Import module:

import { RfxScrollAnimationModule } from 'rfx-scroll-animation';

@NgModule({
  imports: [
    RfxScrollAnimationModule
  ]
})

Initialize scroll animations

In your app.component.ts initialize animation listeners inside ngAfterViewInit WARNING: *use ngAfterViewInit instead of ngOnInit otherwise you may experience glitches on page loading

import { RfxScrollAnimationService } from 'rfx-scroll-animation';

constructor(private rfxScrollAnimationService: RfxScrollAnimationService) { }

public ngAfterViewInit(): void {
  this.rfxScrollAnimationService.initListeners();
}

and if you have a custom scrollbar component you can pass the nativeElement to the initListeners() function like this: WARNING: *use ngAfterViewInit instead of ngOnInit otherwise you may experience glitches on page loading

<custom-scrollbar #scrollbar>
  <!-- Your page here -->
</custom-scrollbar>
@ViewChild('scrollbar')
public scrollbarElement: ElementRef;

public ngAfterViewInit(): void {
  this.rfxParallaxService.initListeners(this.scrollbarElement.nativeElement);
}

Usage

just apply libRfxScrollAnimation to your container and set animation type

<div libRfxScrollAnimation animationType="bottom">
  [...]
</div>

Configuration

distanceFromPageBottomPercentage: number

(default value: 20) when element should appear - in percentage from the bottom of the page (e.g. 20 = 20% of current viewport from the bottom)

animationType: AnimationTypeEnum

(default value: 'none') Available animation types:

  • none - use this if you want to implement a custom animation
  • top - fade in from top
  • bottom - fade in from bottom
  • right - fade in from right
  • left - fade in from left
  • zoom - zoom in / out

animationDistancePx: number

(default value: 25) from how far the animation should fade in - shift value

transitionDurationMs: number

(default value: 500) animation duration in milliseconds

transitionDelayMs: number

(default value: 0) animation delay in milliseconds

transitionTimingFunction: string

(default value: 'cubic-bezier(0.4, 0.0, 0.2, 1)') transition timing function (for more info see https://www.w3schools.com/cssref/css3_pr_transition-timing-function.asp)

scaleRatio: number

(default value: 1.5) ONLY FOR 'zoom' ANIMATION TYPE! scale value (eg. scale from value to 1)

isOnlyFirstTime: boolean

(default value: true) animate only on first scroll (true) or always (false)

elementVisibleChange: EventEmitter<boolean>

listen to show / hide element events and create your own custom animation

<div libRfxScrollAnimation animationType="bottom" (elementVisibleChange)="myCustomFunction($event)">
  [...]
</div>

Demo

You can view all available demos here: https://demo.redfoxxo.dev/

License

This project is licensed under the MIT License