小编the*_*ord的帖子

草图应用程序的橡皮擦

我一直在使用画布制作草图应用程序.我似乎无法使用橡皮擦来处理我的代码.我已经尝试了Stack Overflow的大量答案,其中大多数都不起作用.

例如:

  1. 设置 globalcompositeoperation
  2. 设置alpha为0
  3. 使用clearRect擦除.这工作,但使浏览器非常慢.

所以我希望有人可以帮我解决这个问题.

这是一个演示,这是我的代码:

<html>
    <head>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
        <style type="text/css">
            /*#canvas{background: #F6F683}*/
            .canvasBackground{ position: absolute; top: 8px; left: 8px; width: 1000px; height: 2400px;z-index: -10;}
            #main { position: fixed; top: 5px; left: 1020px; width: 280px; height: 250px;}
            .icon{ cursor: pointer; cursor: hand; }
        </style>
        <script type="text/javascript" src="../js/jquery-1.9.1.js"></script>
        <script type="text/javascript">
            var lWidthE = 15;    //Line width eraser
            var lWidthM = 2;    //Line width marker

            $(document).ready(function() {
                $('.canvasBackground').css("background-image", "url(http://s22.postimg.org/i83b7ztch/notepad_page.png)");
            });

            var canvas; …
Run Code Online (Sandbox Code Playgroud)

javascript html5 canvas

4
推荐指数
1
解决办法
5972
查看次数

标签 统计

canvas ×1

html5 ×1

javascript ×1