michaelvillar / dynamics.js

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

animate background on chrome not working. #42

Open konshensx16 opened 5 years ago

konshensx16 commented 5 years ago

Hello there,

First of all i would like to express my gratitude for this amazing library, also I'm a big fan of your work.

I was playing around with dynamics.js for the first time and noticed that my code does not work on chrome, but does on firefox, the code that throws the error is the following:

dynamics.animate(el, {
      background: "red"
});

the error is the following:

Uncaught TypeError: Cannot read property 'rgb' of undefined
    at e.interpolate (dynamics.min.js:1)
    at e.interpolate (dynamics.min.js:1)
    at t.interpolate (dynamics.min.js:1)
    at t.interpolate (dynamics.min.js:1)
    at q (dynamics.min.js:1)
    at m (dynamics.min.js:1)
    at P (dynamics.min.js:1)

I'm Not sure if it's something that I'm doing wrong, if yes then i can't figure it out.

vardanmovsisyan commented 5 years ago

works fine with rgba() instead of color names, e.g. dynamics.animate(el, { backgroundColor: "rgba(100,149,237,1)" }, { type: dynamics.spring, frequency: 10, friction: 100, duration: 3000, })