我有一个非常简单的paper.js脚本的奇怪情况。如果我不移动鼠标,则5秒后脚本将不会绘制文本。一旦我移动,它就会被显示出来。有人可以向我解释这种奇怪的行为吗?
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Simplify</title>
<script type="text/javascript" src="http://paperjs.org/assets/js/paper.js"></script>
<script type="text/paperscript" canvas="canvas">
setTimeout(function () {
var textItem = new PointText({
content: 'Click and drag to draw a line.',
point: new Point(20, 30),
fillColor: 'black',
});
}, 5000);
</script>
</head>
<body>
<canvas id="canvas" resize></canvas>
</body>
</html>
答案 0 :(得分:5)
您是否尝试过添加paper.view.draw();到你的功能结束?
setTimeout(function () {
var textItem = new PointText({
content: 'Click and drag to draw a line.',
point: new Point(20, 30),
fillColor: 'black',
});
view.draw();
}, 5000);