Colorx
From Unify Community Wiki
Author: Jonathan Czeck (aarku)
Contents |
Description
This script provides a helper function to tie in with HSBColor that will let you slerp between two Unity Colors. The slerp function provides much more pleasing visual results than Color.Lerp.
Usage
Put this script in a file in /Plugins/Colorx.cs so that it may be callable by JavaScript. Additionally, there is a helper class called HSBColor that this relies on. This script, Colorx.cs, provides a quick helper function to slerp between two Colors, which gives much more visually pleasing results than Color.Lerp.
Unity Package
Download the attached package and import it into one of your projects.
C# - Colorx.cs
<csharp>using UnityEngine;
public class Colorx {
public static Color Slerp(Color a, Color b, float t) { return (HSBColor.Lerp(HSBColor.FromColor(a), HSBColor.FromColor(b), t)).ToColor(); }
} </csharp>