GithubHelp home page GithubHelp logo

isabella232 / pixi-movieclip-speed Goto Github PK

View Code? Open in Web Editor NEW

This project forked from experience-monks/pixi-movieclip-speed

0.0 0.0 0.0 2.23 MB

Dynamically adjust PIXI movieclip(s) animation speed based on current browser's fps rate.

License: MIT License

JavaScript 100.00%

pixi-movieclip-speed's Introduction

pixi-movieclip-speed

Dynamically adjust PIXI movieclip(s) animation speed based on current browser's fps rate.

When PIXI movieclip animation speed is set in the range between 0 and 1, it is assumed that your browser always runs at 60fps. Imagine the sprite sheet animation is exported at 24fps and animation speed is set to 0.4 (24/60) but your browser is currently running at only 30fps. In this case, the movieclip animation will visually run slower, so the animation needs to speed it up to compensate lower browser's fps rate.

Install

npm install pixi-movieclip-speed --save

Usage

var pixiMovieclipSpeedHandler = require('pixi-movieclip-speed');

var mc = new PIXI.MovieClip(pixiTexture);
  
// the movieclip needs to run at 24fps
pixiMovieclipSpeedHandler.addClip(mc, 24);

// start the loop engine
pixiMovieclipSpeedHandler.start();

mc.play();

...
 
// remove the movieclip from the loop
mc.stop();
pixiMovieclipSpeedHandler.removeClip(mc);

...

// stop the loop engine when it's not needed anymore
pixiMovieclipSpeedHandler.stop();

License

MIT, see LICENSE.md for details.

pixi-movieclip-speed's People

Contributors

namniak avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.