Skip to content

Instantly share code, notes, and snippets.

@HelveticaScenario
Last active November 27, 2017 11:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HelveticaScenario/97bdcf320606a2736fcede46c3f0ca20 to your computer and use it in GitHub Desktop.
Save HelveticaScenario/97bdcf320606a2736fcede46c3f0ca20 to your computer and use it in GitHub Desktop.
let lastMouse ={
x: -1,
y: -1
}
function _init() {
cls()
}
function _draw(time) {
const [x, y] = mouse()
if (x === -1 || y === -1) {
lastMouse.x = -1
lastMouse.y = -1
return
}
if (lastMouse.x === -1 || lastMouse.y === -1) {
lastMouse.x = x
lastMouse.y = y
}
line(x, y, lastMouse.x, lastMouse.y)
lastMouse.x = x
lastMouse.y = y
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment