خرید بک لینک

Vote count: 0

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 : Caot 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';
        retu 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 !

asked 41 secs ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 7 خرداد 1395 ساعت: 10:03

صفحه بندی