Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use paperscript from external source?

I'm trying to learn paper.js from tutorials, but i'cant make it work from external file .What is the easiest way to implement external paperscript files?

like image 425
volki Avatar asked Nov 01 '13 12:11

volki


1 Answers

Like stated in the Getting started tutorial, if you want to use Paperjs with an external file:

<!DOCTYPE html>
<html>
<head>
    <script type="text/javascript" src="js/paper.js"></script>
    <script type="text/paperscript" src="js/myScript.js" canvas="myCanvas"></script>
</head>
<body>
    <canvas id="myCanvas" resize></canvas>
</body>
</html>

Be sure to specify:

  • the script type "text/paperscript"
  • your canvas ID with the attribute "canvas"
like image 88
FR6 Avatar answered Sep 27 '22 17:09

FR6