使用paper.js库在Google Chrome上出错

时间:2017-10-06 18:13:18

标签: javascript html google-chrome paperjs

Errors on google chrome

我不理解这些错误,因为我从未遇到过这些错误。如果有人可以提供帮助,那将非常感激。该代码应该导致为在随机位置按下的键形成的圆形,同时缩小尺寸直到从页面移除。该代码适用于Firefox Developer Edition但是我仍然只得到弃用错误。我使用了paper.js库。

HTML

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title></title>

    <script type="text/javascript"
            src="assets/js/lib/paper-full.js">
    </script>

    <link   rel="stylesheet"
            href="assets/css/circles.css">

    <script type="text/paperscript"
            canvas="myCanvas"
            src="assets/js/circles.js">
    </script>

  </head>
  <body>
    <canvas id="myCanvas" resize></canvas>
  </body>
</html>

CSS

canvas{
  width: 100%;
  background-color: grey;
  height: 100%;
}

html, body{
  margin: 0%;
  width: 100%;
  height: 100%;
}

的Javascript

var circles = [];

function onKeyDown(event){
  var maxPoint = new Point(view.size.width, view.size.height);
  var randomPoint = Point.random();
  var point = maxPoint * randomPoint;

  circles.push(new Path.Circle({
    center: point,
    radius: 500,
    fillColor: 'violet'
  }));
}

function onFrame(event){
  for(var i=0; i<circles.length; i++){
    circles[i].fillColor.hue += 1;
    circles[i].scale(.9);
  }
}

0 个答案:

没有答案