¡@

Home 

javascript Programming Glossary: lastx

Create a realistic pencil tool for a painting app with HTML5 Canvas

http://stackoverflow.com/questions/10122553/create-a-realistic-pencil-tool-for-a-painting-app-with-html5-canvas

canvas ctx canvas.getContext 2d painting false lastX 0 lastY 0 lineThickness 1 canvas.width canvas.height 600 ctx.fillRect.. function e painting true ctx.fillStyle #ffffff lastX e.pageX this.offsetLeft lastY e.pageY this.offsetTop canvas.onmouseup.. this.offsetTop find all points between var x1 mouseX x2 lastX y1 mouseY y2 lastY var steep Math.abs y2 y1 Math.abs x2 x1 if..

How to drag images / objects within Canvas?

http://stackoverflow.com/questions/18333936/how-to-drag-images-objects-within-canvas

needed in mousemove to determine how far we have dragged lastX mouseX lastY mouseY test if we're over any of the images if.. the mouse has moved since we were last here var dx mouseX lastX var dy mouseY lastY set the lastXY for next time we're here.. last here var dx mouseX lastX var dy mouseY lastY set the lastXY for next time we're here lastX mouseX lastY mouseY handle drags..

Listen to multiple keydowns

http://stackoverflow.com/questions/7614340/listen-to-multiple-keydowns

clearTimeout timer timer setTimeout reset timeout var lastX false var lastY false function keyCombi Array keys Are the following.. positive false Are we heading to a different direction if lastX x lastY y animation.move x y lastX x lastY y Add event listener.. different direction if lastX x lastY y animation.move x y lastX x lastY y Add event listener var eventType keydown window on..