javascript 如何通过 onTouch 方法触摸来移动 html5 画布元素(矩形)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10582058/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to move a html5 canvas element(rectangle) by touching it by onTouch method
提问by Laxmi Kant
I have created a rectangle inside a canvas and i want to move it right side by touching this rectangle.it may just like draging rectangle along a straight line. Thanks in advance
我在画布内创建了一个矩形,我想通过触摸这个矩形将它向右移动。它可能就像沿直线拖动矩形一样。提前致谢
回答by coder
I think this is what you need
我想这就是你所需要的
http://simonsarris.com/blog/140-canvas-moving-selectable-shapeshttp://www.html5canvastutorials.com/kineticjs/html5-canvas-stop-animation-with-kineticjs/
http://simonsarris.com/blog/140-canvas-moving-selectable-shapes http://www.html5canvastutorials.com/kineticjs/html5-canvas-stop-animation-with-kineticjs/