Skip to content

A mathematical function to describe decelerating wheels like in slot machines

Notifications You must be signed in to change notification settings

robertblackwell/accelerate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Accelerate

Usage

const initVelocity = 0

const car = new PIXI.Sprite();
const carAccelerator = new Accelerator(initVelocity);

// animate on frame
function ticker(delta) {
    car.position.x += carAccelerator.getDistance(delta)

    window.requestAnimationFrame(ticker);
}
window.requestAnimationFrame(ticker);

// Promise based
carAccelerator.to(newV, overDist, overTime)
.then(carAccelerator.to(newV, overDist))
.then(carAccelerator.to(newV, overTime))
.then(console.log('done'))

Commands

Test

Run tests

npm test

Lint

Run the linter

npm run lint

About

A mathematical function to describe decelerating wheels like in slot machines

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published