paperjs - paper.js and javascript 'this' confusion -
paperjs - paper.js and javascript 'this' confusion -
hi creating cabinet object in javascript , trying access objects property within paper.js' onframe function... when utilize 'this' within onframe function can not access object property:
function cabinet(){ this.spine = new path({x:0, y:0}); this.draw(); homecoming this; } cabinet.prototype = { draw:function(){ view.onframe = function(event) { this.spine // trying access cabinet object not referring cabinet object } } } how can accomplish this?
you bind function this becomes reference cabinet object.
cabinet.prototype = { draw: function() { view.onframe = function(event) { this.spine; }.bind(this); } } javascript paperjs
Comments
Post a Comment