Colorx

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
(New page: Category: C Sharp Category: Utility Category: Color Category: HSB Author: Jonathan Czeck (aarku) ==Description== This script provides a helper function to tie in with [[HSB...)
 
m (C# - Colorx.cs)
Line 15: Line 15:
 
==C# - Colorx.cs==
 
==C# - Colorx.cs==
 
<csharp>using UnityEngine;
 
<csharp>using UnityEngine;
using System.Collections;
 
  
 
public class Colorx
 
public class Colorx

Revision as of 14:55, 11 August 2007

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>

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox