Animate scene background color

Hi :vulcan_salute:

I’m trying to animate the scene background color, and it behaves weirdly.

If one of the RGB values is not 0, I always get white color. If I set one of the values to 0, it’s always the same color. Looks like RGB values are always on 255.

Code I’m trying:

new TWEEN.Tween(scene.background)
  .to({
    r: Math.random() * 255,
    b: Math.random() * 255,
    g: Math.random() * 255,
  })
  .easing(TWEEN.Easing.Exponential.InOut)
  .start()

new TWEEN.Tween(this).to({}, 1000).onUpdate(this.render).start()

Here is the fiddle:

Please help :pray:

The r, g and b components of THREE.Color are between 0 and 1.

Thank you, that worked :slight_smile: