Paper.js: Point math returning NaN

Created on 19 Oct 2014  路  2Comments  路  Source: paperjs/paper.js

console.log(rightPoint, leftPoint)
console.log(rightPoint - leftPoint)

->
Point: {x:0, y:0}, Point:{x:10, y:10}
NaN

Shouldnt this work..?

Most helpful comment

Where are you executing this code? The Math operator overloading will only work if it's in a PaperScript context. If not, you'll need to use:

rightPoint.subtract(leftPoint)

All 2 comments

Where are you executing this code? The Math operator overloading will only work if it's in a PaperScript context. If not, you'll need to use:

rightPoint.subtract(leftPoint)

ah ok
it is outside of the paperscript
so im doing this :
var rightPoint = new paper.Point(x,y);
(haven't got code to hand, but something like that is what im doing lol)

I shall do your suggestion this eve cheers !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Mark12870 picture Mark12870  路  3Comments

nicholaswmin picture nicholaswmin  路  3Comments

croqaz picture croqaz  路  6Comments

hapticdata picture hapticdata  路  5Comments

jsbroks picture jsbroks  路  4Comments