Colorx

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
(Unity Package)
(Removing all content from page)
Line 1: Line 1:
[[Category: C Sharp]]
 
[[Category: Utility]]
 
[[Category: Color]]
 
[[Category: HSB]]
 
Author: Jonathan Czeck (aarku)
 
==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.
 
 
<span class="dangerousLink">[[Media:HSBColor.unityPackage.zip|HSBColor.unityPackage.zip]]</span>‎
 
 
==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>
 

Revision as of 18:13, 19 October 2009

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox