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

react-sequence-player

v1.1.0

Published

react component for sequence playing in <div>

Downloads

34

Readme

react-sequence-player

ReactJs Typescript Download Count

  • Live Demo
  • Image Sequence Player for ReactJS.
  • Selectable Navgation Styles.
  • What is Image Sprite?

Install

// npm
npm install react-sequence-player --save

// yarn
yarn add react-sequence-player

Usage

import SequencePlayer from 'react-sequence-player';
import SequenceImage from 'your sequence image';

const SomeComponent = () => {
    const playerRef = React.useRef(null);

    const handleControl = (action) => () => {
      switch (action) {
        case 'play': playerRef.current.play(); break;
        case 'pause': playerRef.current.pause(); break;
        case 'resume': playerRef.current.resume(); break;
        case 'reverse': playerRef.current.reverse(); break;
      }
    };

    return (
        <div>
            <button onClick={handleControl('play')}>PLAY</button>
            <button onClick={handleControl('pause')}>PAUSE</button>
            <button onClick={handleControl('resume')}>RESUME</button>
            <button onClick={handleControl('reverse')}>REVERSE PLAY</button>

            <SequencePlayer
                image={SampleImage}
                data={[
                    { x: -700, y: 0 },
                    { x: -600, y: 0 },
                    { x: -500, y: 0 },
                    { x: -400, y: 0 },
                    { x: -300, y: 0 },
                    { x: -200, y: 0 },
                    { x: -100, y: 0 },
                    { x: 0, y: 0 }
                ]}
                playerSize={{ width: 100, height: 230 }}
                imageSize={{ width: 800, height: 230 }}
                ref={playerRef}
            />
        </div>
    );
};

If You want to see more detail source,

Props

|Name|Type|Required|Description|Default| |:--:|:--:|:-----:|:----------|:------| |image|String|Required|image resource|| |data|Array<{ x: number; y: number; }>|Required|image sequence position array[{ x: 0, y: 0 }, { x: 100, y: 0 }, { x: 100, y: 0 }]|| |playerSize|{ width: number; height: number; }|Required|image sprite contrainer(=div) size|| |imageSize|{ width: number; height: number; }|Required|image resource's size|0.5| |delay|Number|Optional|sequence update delay|50| |logging|Boolean|Optional|console logging in player component|false| |style|React.CSSProperties|Optional|style object for image sprite contrainer|undefined| |forMobile|Boolean|Optional|Toggle GPU Render|false| |onLoad|() => void|Optional|image onLoad event callback|undefined| |onStart|() => void|Optional|sequence event callback when started|undefined| |onPaused|() => void|Optional|sequence event callback when paused|undefined| |onComplete|() => void|Optional|sequence event callback when completed|undefined|

Development

directory & source

  • ./example/ : storybook source for testing component
  • ./src/ : component source
  • ./dist/ : component distribution
  • ./rollup.config.js : rollup configure.

scripts

// npm
npm run dev             // developing a component
npm run build           // build a component by rollup
npm run build:watch     // build watch mode

// yarn
yarn example
yarn build
yarn buidl:watch