litecanvas / game-engine

🎮 Lightweight HTML5 canvas engine suitable for small games, prototypes and animations.
https://litecanvas.js.org/
MIT License
30 stars 4 forks source link

Implement wrap() #16

Closed luizbills closed 6 months ago

luizbills commented 6 months ago

function wrap (value, min, max) {
  return value - (max - min) * Math.floor((value - min)/(max - min))
}