Why change the light color so fast?

Under script is my question.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LightColorChange : MonoBehaviour {

private Color kleuR;
public GameObject dirLight;
public float takeColorTime = 30;

void Update () {
	kleuR =Color.Lerp(Color.red, Color.blue , takeColorTime * Time.deltaTime);	
}

void FixedUpdate() {
	dirLight.GetComponent<Light> ().color = kleuR ;

}

}

why is my color chaning so fast and how an i fix it?

@meenjedat
Color.Lerp has the third parameter that interpolates betewen 0 and 1 and you are giving it a large value.
What you can do is that take a variable and increment it in Update with Time.deltaTime and make takeColorTime value to be small.

  float interval = 0f;
  void Update () {
    interval += Time.deltaTime;
    kleuR =Color.Lerp(Color.red, Color.blue , takeColorTime*interval);    
   }

Mayby use an other void? not sure.

Unless you’re writing a script that cleverly changes your light based on how long frame calculations take, this isn’t going to be what you want.

Here, you are always starting between Red and Blue – there will not be any transition at all because you aren’t keeping track of intermediate steps along your supposed transition.

Your time multiple also looks very high for lerp. Is this what you meant to do?

private float colorTransitionMultiple = 1;
private float colorTransitionProgress = 0;

 void Update () {
     this.colorTransitionProgress  += Time.deltaTime * this.colorTransitionMultiple ;
     kleuR =Color.Lerp(Color.red, Color.blue , this.colorTransitionProgress);    
 }
 void FixedUpdate() {
     dirLight.GetComponent<Light> ().color = kleuR ;
 }