void Update() { float totalTime = endTime - startTime; float currentTime = Time.time - startTime; GlitchSetting.Lerp(ref currentGlitch, maxGlitch, nonGlitch, currentTime / totalTime); currentGlitch.Overwrite(hardware); }
public static void Lerp(ref GlitchSetting target, GlitchSetting start, GlitchSetting end, float amount) { target.chromaticAberration = Mathf.Lerp(start.chromaticAberration, end.chromaticAberration, amount); target.axialAberration = Mathf.Lerp(start.axialAberration, end.axialAberration, amount); target.blur = Mathf.Lerp(start.blur, end.blur, amount); target.blurSpread = Mathf.Lerp(start.blurSpread, end.blurSpread, amount); target.luminanceDependency = Mathf.Lerp(start.luminanceDependency, end.luminanceDependency, amount); target.blurDistance = Mathf.Lerp(start.blurDistance, end.blurDistance, amount); }
void Awake() { hardware = GetComponent <VignetteAndChromaticAberration>(); nonGlitch = new GlitchSetting(hardware); currentGlitch = new GlitchSetting(hardware); }