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

@aandrek/fxe

v0.4.13

Published

A library to call functions in sync with a beat

Downloads

590

Readme

FXE (FX Engine)

A TypeScript library for synchronizing functions and animations with a beat. FXE provides utilities to create rhythm-based effects, animations, and visualizations that stay in sync with a BPM (beats per minute) clock.

Overview

FXE is designed for creative coding, audio-visual applications, and music visualizers where timing animations and effects to a musical beat is essential. It leverages Three.js Clock for precise time management and offers a suite of interpolation and timing functions.

Features

  • BPM Synchronization: Execute functions and animate values in sync with a configurable BPM
  • Multiple Interpolation Methods:
    • Linear BPM interpolation with optional easing functions
    • Wave-based interpolation (cosine) for smooth oscillations
    • MIDI value interpolation (0-127 range)
    • Percentage-based interpolation
  • Strobe Effects: Toggle between values based on beat timing
  • Array Value Selection: Pick values from arrays based on beat position
  • Flexible Timing Controls:
    • Offset support for phase-shifted animations
    • Beat measure multipliers (e.g., trigger every 2 beats, or twice per beat)
    • Optional looping control
    • Custom easing functions

Installation

npm install @aandrek/fxe

Usage

import Fxengine from '@aandrek/fxe';
import { Clock } from 'three';

// Create a clock and initialize FXE with a BPM
const clock = new Clock();
const fxe = new Fxengine(clock, 120); // 120 BPM

// Call a function once per beat
fxe.fxBPMCallFn(() => {
  console.log('Beat!');
}, 0, 1);

// Interpolate a value based on BPM (e.g., for animation)
const animatedValue = fxe.fxBPMInterpolation(
  0,      // min value
  100,    // max value
  0,      // offset
  1       // beat measure
);

// Create a wave effect
const waveValue = fxe.fxBPMWaveInterpolation(0, 360, 0, 1);

// Strobe between two values
const strobeColor = fxe.fxStrobe('#ff0000', '#0000ff', 0, 1);

API Reference

Constructor

new Fxengine(clock: Clock, bpm: number)

Main Methods

  • fxBPMCallFn(fn, offsetPercentage, beatMeasure): Execute a function in sync with the beat
  • fxBPMInterpolation(minValue, maxValue, fxOffsetSeed, beatMeasure, easingFn, loop): Interpolate between values based on BPM timing
  • fxBPMWaveInterpolation(minValue, maxValue, fxOffsetSeed, beatMeasure, easingFn): Create wave-based interpolations
  • fxStrobe(value1, value2, fxOffset, beatMeasure): Toggle between two values
  • fxBPMArrayValue(valueArray, fxOffset, beatMeasure): Select values from an array based on beat position
  • fxMidiInterpolation(minValue, maxValue, midiValue): Convert MIDI values (0-127) to custom ranges
  • fxPercentInterpolation(minValue, maxValue, percent): Interpolate based on percentage (0-1)

Properties

  • bpm: Beats per minute
  • clock: Three.js Clock instance
  • effectWindow: Duration of one beat in seconds

Use Cases

  • Music visualizers
  • VJ software and live visuals
  • Rhythm games
  • Audio-reactive animations
  • Creative coding projects
  • Real-time audio-visual performances

License

ISC

Author

aandrek - aa.ndrek.com

Repository

https://github.com/aandrek/fxe