清除草图仍然在html5的画布上 [英] cleared sketch still on canvas in html5

查看:179
本文介绍了清除草图仍然在html5的画布上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是对画布清晰的东西感到困惑 - 草图已从画布上清除,但当我点击画布绘制新的东西,清除的草图只是在相同的位置再次回来。它看起来像草图已保存到一些饼干,当下次单击画布或鼠标在画布上时已重新加载。

I just get confused about canvas clear stuff -- the sketch has been cleared from canvas, but when I click the canvas to draw something new, the cleared sketch just come back at the same position again. It looks like the sketch has been saved to some "cookies", which has been reloaded when the next time clicking the canvas or mouse over the canvas.

clear.click(function()){
var canvas = document,getElementById('mycanvas');
var context = canvas.getContext('2d');
context.clearRect(0,0,width,height);
});

我使用sketch.js绘制: http://intridea.github.com/sketch.js/
实际上,sketch.js中的代码干净了canvas:canvas。 width = canvas.width。有关如何彻底清除它的任何想法?谢谢!

I use sketch.js for drawing: http://intridea.github.com/sketch.js/ Actually, the code in sketch.js did clean canvas too: canvas.width = canvas.width. Any idea about how to clear it thoroughly? thanks!

推荐答案

这是代码的其他部分给出的问题,我已经解决了。看起来像以前的草图已经保存在数组中,每次我将当前草图添加到数组,并绘制一切。谢谢!对不起的烦恼。

It's the other part of code gives the problem,and I've already fixed it. It looks like the former sketch has been saved in an array, and each time I add the current sketch to the array, and draw everything there. Thanks! And sorry for the bothering.

这篇关于清除草图仍然在html5的画布上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆