I'm still new to js, and I'm trying to put bonsai.js in the base application.
I follow this guide here: https://github.com/iamdustan/bonsai-demos and try to "Split Everything" by putting the animation in a separate file called hero-animation.js, but I get Uncaught TypeError: Illegal constructorin the first linehero-animation.js
This is called on my Backbone router and it works 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 leads to 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
});
ac360 source
share