> If I removed the `var company.animation ..`, then code works but I > don't know what's wrong with it...
You don't need a "var" on that line. You're not creating a new variable, you're creating a new property on an existing object. company.animation = {};