Using Paperjs:
<script type="text/javascript" src="paper.js"></script>
<script type="text/paperscript" canvas="myCanvas" src="myapp.js"></script>
Trying to create a class in myapp.js:
class Petal {
constructor(index, x, y, diameter, round) {
this.index = index;
this.x = x;
this.y = y;
this.diameter = diameter;
this.round = round;
This creates a "syntax error unexpected token" in paper.js(not my code, thats the paperjs framework) at [paper.js:15421:12].
It refers to this (line 4 being 14521):
function raise(pos, message) {
var loc = getLineInfo(input, pos);
message += " (" + loc.line + ":" + loc.column + ")";
var err = new SyntaxError(message);
err.pos = pos; err.loc = loc; err.raisedAt = tokPos;
throw err;
}
I'm new to coding like this and I'm just stumped. The class I'm making doesn't even use any code from paperjs so I don't know why it's creating an error in the paper.js file. Also new to stack overflow so please tell me what I am doing wrong.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…