This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @Param integer, integer - Takes two integers as input | |
// Returns an integer that is min inclusive and max exclusive | |
// @Return integer | |
const randomIntRange = (min, max) => { | |
min = Math.ceil(min); | |
max = Math.floor(max); | |
return Math.floor(Math.random() * (max - min)) + min; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @param Object - Takes a mouse move event object as input | |
// @return Object - returns an object with an x and y coordinate | |
const relativeCoords = ( event ) => { | |
let bounds = event.target.getBoundingClientRect(); | |
let x = event.clientX - bounds.left; | |
let y = event.clientY - bounds.top; | |
return {x: x, y: y}; | |
} |
NewerOlder