michaelvillar / dynamics.js

Javascript library to create physics-based animations
http://dynamicsjs.com
7.57k stars 414 forks source link

Uncaught TypeError: Cannot read property 'format' of null #21

Closed ollipop closed 8 years ago

ollipop commented 8 years ago

I tried using this code. It seems to be working well on safari but triggers an error on chrome and the other browers. Is there an extra set up needed?

var dots = document.querySelectorAll('.dot') var colors = ['#007EFF', '#FF3700', '#92FF00']

// Start the 3 dot animations with different delays function animateDots() { for(var i=0; i<dots.length; i++) { dynamics.animate(dots[i], { translateY: -70, backgroundColor: colors[i] }, { type: dynamics.forceWithGravity, bounciness: 800, elasticity: 200, duration: 2000, delay: i * 450 }) }

dynamics.setTimeout(animateDots, 2500) }

animateDots()

ollipop commented 8 years ago

If I open to see the error details it returns the followings:

Uncaught TypeError: Cannot read property 'format' of null applyProperties @ dynamics.js:111 applyFrame @ dynamics.js:90 animationTick @ dynamics.js:1371 runLoopTick @ dynamics.js:1336

michaelvillar commented 8 years ago

Can you share your code? It seems like you're trying this code http://dynamicsjs.com/examples/loader.html which works fine on Chrome here.

ollipop commented 8 years ago

@michaelvillar Thank you for your quick response. I started all over and copied the code from the source and got it working. Sorry for the trouble, Thanks again!