lesca-enterframe
TypeScript icon, indicating that this package has built-in type declarations

1.3.1 • Public • Published

React React React React React NPM React NPM

Why use it?

Use it calculator timestamp for animation.

Live Demo

Installation

npm install lesca-enterframe --save

Usage

As a Node module:

import { useState, useEffect } from 'react';
import EnterFrame from 'lesca-enterframe';

const Component = () => {
  const [time, setTime] = useState(0);

  useEffect(() => {
    EnterFrame.add((e) => {
      const { delta } = e;
      setTime(delta);
    });
  }, []);

  return (
    <div>
      <h1>{time}</h1>
      <button onClick={() => EnterFrame.play()}>Play</button>
      <button onClick={() => EnterFrame.stop()}>Stop</button>
    </div>
  );
};

Development

Methods

method description return
.add(frame:function) extend call func void
.play() continue calling func void
.stop() stop calling func void
.undo() reverse to last function void
.destroy() remove event void
.setFPS(fps:number) set FPS void
.reset(fps:number) reset delta void

Properties

Properties type description default
todo Object get function and list of function history []

Features

  • maintain if necessary

Readme

Keywords

Package Sidebar

Install

npm i lesca-enterframe

Weekly Downloads

44

Version

1.3.1

License

MIT

Unpacked Size

21 kB

Total Files

28

Last publish

Collaborators

  • jameshsu1125