I am a javascript newbie who's trying to transition from processing to javascript.
Using Paper.js, I am simply trying to understand the equivalent of classes and their functions with the code below but keep having this error : Cannot read property 'move' of undefine.
function Apple (center) {
this.color = 'red';
this.center = center;
this.path = new Path.Circle(this.center, 50);
this.path.fillColor = 'black';
return this.path;
}
Apple.prototype.move = function(){
console.log('allo');
}
var Apples = [];
var nbA = 10;
for(var i=0; i < nbA; i++){
var center = new Point.random() * view.size;
Apples.push(new Apple(center));
}
function onFrame(event){
for(var i=0; i < Apples.length; i++){
Apples[i].prototype.move();
}
}
Can anybody shed some light ? Thanks !