Change element BG color dynamically


#1

Hi,

I need to fade BG color of a div from one color to another.

I know it is possible with CSS3.

However I need to trigger the animation from JS and be able to specify a color and animation time (both these values are being received through socket.io)

example;

HTML

JS

this.socket.on(‘color’, (color) => {
duration = this.duration;
//this is what I used to do in jQuery
// how should I go about this in angular-animate??
jQuery(’#colorDIV’).animate({backgroundColor: color}, {duration: duration});
});

Thank you so very much in advance.