This package has been deprecated

Author message:

The '@studio-freight/tempus' package has been renamed to 'tempus'. Please update your dependencies: npm install tempus and visit the documentation: https://www.npmjs.com/package/tempus

@studio-freight/tempus
TypeScript icon, indicating that this package has built-in type declarations

0.0.44 • Public • Published

Purpose

Tempus allows you to merge all your requestAnimationFrame (rAF) loops in one for better performance and gives you better control over their execution priority.

Installation

$ npm i @studio-freight/tempus

Usage

import Tempus from '@studio-freight/tempus'

function onFrame(time, deltaTime) {
  // called every frame
}

// subscribe
const unsubscribe = Tempus.add(onFrame, 0)

// unsubscribe
unsubscribe()
// OR
Tempus.remove(onFrame)

Methods

  • add(callback, priority)
  • remove(callback)

Examples

GSAP

gsap.ticker.remove(gsap.updateRoot);
Tempus.add((time) => {
  gsap.updateRoot(time / 1000);
}, 0);

Lenis

Tempus.add((time) => {
  lenis.raf(time)
}, 0);

Readme

Keywords

Package Sidebar

Install

npm i @studio-freight/tempus

Weekly Downloads

7,941

Version

0.0.44

License

MIT

Unpacked Size

12.8 kB

Total Files

11

Last publish

Collaborators

  • arzafran
  • clementroche
  • gfier
  • lsoengas