I'm making a "class" in a file called Animation.js:
function Animation(s) {
this.span = s;
};
Animation.prototype = Object.create(Animation.prototype);
Animation.prototype.constructor = Animation;
And I create a child class which is in a file called LinearAnimation.js:
function LinearAnimation(s, cP) {
Animation.call(s);
this.controlPoints = cP;
};
LinearAnimation.prototype = Object.create(Animation.prototype);
LinearAnimation.prototype.constructor = LinearAnimation;
The problem is, when I access to this.span member in the LinearAnimation class it says it's undefined. Am I implementing this well? Thank you.
Animation.call(this, s), notAnimation.call(s). The first argument tocallsetsthisfor the function invocation.Animation.prototype = Object.create(Animation.prototype);is probably not what you wanted either.