Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const mouse = {
- x: undefined,
- y: undefined,
- }
- $('#canvas').mousemove(function(){
- mouse.x = event.x
- mouse.y = event.y
- })
- let circleArray = []
- //Create circles based on how long you hold the mouse down
- let timer = 0
- $('#canvas').mousedown(function () {
- timer = new Date()
- }).mouseup(function () {
- let timePassed = (new Date () - timer)/10
- if(timePassed > 100){
- timePassed = 100}
- let radius = timePassed
- timer = 0
- let x = event.x
- let y = event.y
- let dx = (Math.random()-0.5) *10
- let dy = (Math.random()-0.5) *10
- circleArray.push(new Circle(x, y, dx, dy, radius))
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement