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 🙏

© 2026 – Pkg Stats / Ryan Hefner

syrup-js-engine

v1.0.2

Published

A smooth scroll engine with customizable velocity for buttery scrolling animations

Readme

SyrupJS

A smooth scroll engine with customizable velocity for buttery scrolling animations. Perfect for landing pages and "Back to Top" buttons.

Features

  • 🍯 Customizable Velocity - Control how slow or smooth your scrolling is
  • 🎨 Multiple Easing Functions - Choose from various easing curves
  • RequestAnimationFrame Powered - Smooth 60fps animations
  • 🎯 Element & Position Scrolling - Scroll to any element or exact position
  • 📱 Lightweight - No dependencies, pure JavaScript
  • 🛑 Cancellable - Cancel ongoing scroll animations

Installation

npm install syrupjs

Quick Start

// Using the default instance
const { syrup } = require('syrupjs');

// Scroll to top
syrup.scrollToTop();

// Scroll to element
syrup.scrollToElement('#about-section');

// Scroll to specific position
syrup.scrollTo(500);

API Reference

Default Instance

const { syrup } = require('syrupjs');

The default instance comes with sensible defaults:

  • Velocity: 0.08
  • Easing: easeOutCubic

Custom Instance

const { SyrupJS } = require('syrupjs');

const customSyrup = new SyrupJS({
  velocity: 0.05,  // Slower scrolling
  easing: 'easeInOutQuad'  // Different easing
});

Methods

scrollTo(targetY, duration)

Scroll to a specific Y position.

syrup.scrollTo(1000);        // Auto-calculated duration
syrup.scrollTo(1000, 1500); // Custom duration (1.5 seconds)

scrollToElement(element, offset, duration)

Scroll to an element.

syrup.scrollToElement('#section-2');
syrup.scrollToElement('.my-class', 100); // With 100px offset
syrup.scrollToElement(document.getElementById('my-element'));

scrollToTop(duration)

Scroll to the top of the page.

syrup.scrollToTop();
syrup.scrollToTop(800); // Custom duration

setVelocity(velocity)

Update velocity setting (0.01 - 0.2).

syrup.setVelocity(0.02); // Very slow and smooth
syrup.setVelocity(0.15); // Fast scrolling

setEasing(easingType)

Update easing function.

syrup.setEasing('linear');
syrup.setEasing('easeInCubic');
syrup.setEasing('easeInOutQuart');

cancelScroll()

Cancel any ongoing scroll animation.

syrup.cancelScroll();

isCurrentlyScrolling()

Check if currently scrolling.

if (syrup.isCurrentlyScrolling()) {
  console.log('Scrolling in progress...');
}

Easing Functions

Available easing functions:

  • linear
  • easeInQuad, easeOutQuad, easeInOutQuad
  • easeInCubic, easeOutCubic, easeInOutCubic
  • easeInQuart, easeOutQuart, easeInOutQuart
  • easeInQuint, easeOutQuint, easeInOutQuint

Velocity Guide

  • 0.01 - 0.03: Very slow, syrupy smooth
  • 0.04 - 0.08: Smooth and pleasant (default)
  • 0.09 - 0.15: Moderate speed
  • 0.16 - 0.20: Fast scrolling

Examples

Back to Top Button

document.getElementById('back-to-top').addEventListener('click', () => {
  syrup.scrollToTop(1000); // 1 second animation
});

Smooth Navigation

document.querySelectorAll('a[href^="#"]').forEach(anchor => {
  anchor.addEventListener('click', (e) => {
    e.preventDefault();
    const target = anchor.getAttribute('href');
    syrup.scrollToElement(target, 80); // 80px offset for fixed headers
  });
});

Custom Slow Scrolling

const slowSyrup = new SyrupJS({ velocity: 0.03 });
slowSyrup.scrollToElement('#hero');

Development

npm install
npm test

License

MIT