External scripting not working in PaperJS

800 views
Skip to first unread message

Navi Jha

unread,
Jun 13, 2015, 6:31:46 AM6/13/15
to pap...@googlegroups.com

I am new to paperJS and I'm trying to include an external paperscript file in html, but it isn't working. While the inline scripting is working fine. My code are:

HTML Code:

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

paperScript Code (myScript.js):

// Create a Paper.js Path to draw a line into it:
var path = new Path();
// Give the stroke a color
path.strokeColor = 'black';
var start = new Point(100, 100);
// Move to start and draw a line from there
path.moveTo(start);
// Note the plus operator on Point objects.
// PaperScript does that for us, and much more!
path.lineTo(start + [ 100, -50 ]);

I found an old link on stackOverflow which says that using version 0.9.10 fix the problem. But is that issue still not fixed in newer version? Here's the link:

How to use paperscript from external source?

Jürg Lehni

unread,
Jun 16, 2015, 5:33:35 AM6/16/15
to pap...@googlegroups.com
You’re probably loading from the local file system? If so, then CORS is the reason why:


--
You received this message because you are subscribed to the Google Groups "Paper.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to paperjs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages