admin管理员组文章数量:1303536
I'm still new to js and I'm trying to fit bonsai.js into a backbone app.
I'm following this guide here: , and trying to 'Separate Things Out' by putting the animation into a separate file titled hero-animation.js
, but I get an Uncaught TypeError: Illegal constructor
on the first line of hero-animation.js
This is called in my Backbone router, and is working fine...
homeAnimation: function() {
bonsai.run(document.getElementById('heroContent'), {
url: 'hero-animation.js',
width: 500,
height: 400
});
}
Here is what I have in hero-animation.js which is resulting in an error on line 1:
var rect = new Rect(0, 0, 200, 200);
rect
.fill('random')
.addTo(stage)
.attr({
x: stage.width - rect.attr('width'),
y: stage.width - rect.attr('height')
})
.animate('0.5s', {
x: 0,
y: 0
});
I'm still new to js and I'm trying to fit bonsai.js into a backbone app.
I'm following this guide here: https://github./iamdustan/bonsai-demos , and trying to 'Separate Things Out' by putting the animation into a separate file titled hero-animation.js
, but I get an Uncaught TypeError: Illegal constructor
on the first line of hero-animation.js
This is called in my Backbone router, and is working fine...
homeAnimation: function() {
bonsai.run(document.getElementById('heroContent'), {
url: 'hero-animation.js',
width: 500,
height: 400
});
}
Here is what I have in hero-animation.js which is resulting in an error on line 1:
var rect = new Rect(0, 0, 200, 200);
rect
.fill('random')
.addTo(stage)
.attr({
x: stage.width - rect.attr('width'),
y: stage.width - rect.attr('height')
})
.animate('0.5s', {
x: 0,
y: 0
});
Share
Improve this question
edited Apr 25, 2013 at 21:54
ac360
asked Apr 25, 2013 at 21:49
ac360ac360
7,83514 gold badges55 silver badges95 bronze badges
1
- stackoverflow./questions/9950876/… may help you. – Loamhoof Commented Apr 25, 2013 at 22:23
1 Answer
Reset to default 5Seems like you forgot to include bonsai.js
.
Initially, Rect
is an "interface", which means it can't be used as a constructor, and Bonsai overrides it for its own purposes.
本文标签: javascriptUncaught TypeError Illegal constructor – Using BonsaiJS in BackboneJSStack Overflow
版权声明:本文标题:javascript - Uncaught TypeError: Illegal constructor – Using Bonsai.JS in Backbone.JS - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741758940a2396284.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论