title: Uncaught TypeError: Illegal constructor – Using Bonsai.JS in Backbone.JS
body: <p>I'm still new to js and I'm trying to fit bonsai.js into a backbone app.  </p>
  
  <p>I'm following this guide here:  <a href="https://github.com/iamdustan/bonsai-demos" rel="noreferrer">https://github.com/iamdustan/bonsai-demos</a> , and trying to 'Separate Things Out' by putting the animation into a separate file titled <code>hero-animation.js</code>, but I get an <code>Uncaught TypeError: Illegal constructor</code> on the first line of <code>hero-animation.js</code></p>
  
  <p>This is called in my Backbone router, and is working fine...</p>
  
  <pre><code>homeAnimation: function() {
      bonsai.run(document.getElementById('heroContent'), {
      url: 'hero-animation.js',
      width: 500,
      height: 400
    });
  }
  </code></pre>
  
  <p>Here is what I have in hero-animation.js which is resulting in an error on line 1:</p>
  
  <pre><code>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
  });
  </code></pre>