animated color: how to smooth?

hi there,

found a script changing skybox-color when pressing a key, which is wonderful. my question now is, how can i smooth this animation with an easing-in/-out?

maybe anyone can help!

here is my code:

var color1 =;
var color2 =;
var duration = 10;

function Start() {

function Update () {
    if (Input.GetKey(KeyCode.Return)) {
        camera.backgroundColor = color1;

    } else {
        camera.backgroundColor = color2;        

thank you! andreas

You can use


which (blendValue = 0 ) means color1 and (blendValue = 1) means color2.

then you should smoothly change the blendValue. you can do this with an animation clip or any other method.

Hope that helps.