本文整理汇总了C#中Channels.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# Channels.Contains方法的具体用法?C# Channels.Contains怎么用?C# Channels.Contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Channels
的用法示例。
在下文中一共展示了Channels.Contains方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Average
public static float Average(this Color color, Channels channels)
{
float average = 0;
int axisCount = 0;
if (channels.Contains(Channels.R))
{
average += color.r;
axisCount += 1;
}
if (channels.Contains(Channels.G))
{
average += color.g;
axisCount += 1;
}
if (channels.Contains(Channels.B))
{
average += color.b;
axisCount += 1;
}
if (channels.Contains(Channels.A))
{
average += color.a;
axisCount += 1;
}
return average / axisCount;
}
示例2: Lerp
public static Color Lerp(this Color color, Color target, float time, Channels channels)
{
color.r = channels.Contains(Channels.R) && Mathf.Abs(target.r - color.r) > epsilon ? Mathf.Lerp(color.r, target.r, time) : color.r;
color.g = channels.Contains(Channels.G) && Mathf.Abs(target.g - color.g) > epsilon ? Mathf.Lerp(color.g, target.g, time) : color.g;
color.b = channels.Contains(Channels.B) && Mathf.Abs(target.b - color.b) > epsilon ? Mathf.Lerp(color.b, target.b, time) : color.b;
color.a = channels.Contains(Channels.A) && Mathf.Abs(target.a - color.a) > epsilon ? Mathf.Lerp(color.a, target.a, time) : color.a;
return color;
}
示例3: Div
public static Color Div(this Color color, Color otherVector, Channels channels)
{
color.r = channels.Contains(Channels.R) ? color.r / otherVector.r : color.r;
color.g = channels.Contains(Channels.G) ? color.g / otherVector.g : color.g;
color.b = channels.Contains(Channels.B) ? color.b / otherVector.b : color.b;
color.a = channels.Contains(Channels.A) ? color.a / otherVector.a : color.a;
return color;
}
示例4: SetValues
public static Color SetValues(this Color color, Color values, Channels channels)
{
color.r = channels.Contains(Channels.R) ? values.r : color.r;
color.g = channels.Contains(Channels.G) ? values.g : color.g;
color.b = channels.Contains(Channels.B) ? values.b : color.b;
color.a = channels.Contains(Channels.A) ? values.a : color.a;
return color;
}
示例5: Round
public static Color Round(this Color color, float step, Channels channels)
{
color.r = channels.Contains(Channels.R) ? color.r.Round(step) : color.r;
color.g = channels.Contains(Channels.G) ? color.g.Round(step) : color.g;
color.b = channels.Contains(Channels.B) ? color.b.Round(step) : color.b;
color.a = channels.Contains(Channels.A) ? color.a.Round(step) : color.a;
return color;
}
示例6: Pow
public static Color Pow(this Color color, float power, Channels channels)
{
color.r = channels.Contains(Channels.R) ? color.r.Pow(power) : color.r;
color.g = channels.Contains(Channels.G) ? color.g.Pow(power) : color.g;
color.b = channels.Contains(Channels.B) ? color.b.Pow(power) : color.b;
color.a = channels.Contains(Channels.A) ? color.a.Pow(power) : color.a;
return color;
}
示例7: Oscillate
public static Color Oscillate(this Color color, Color frequency, Color amplitude, Color center, float offset, Channels channels)
{
color.r = channels.Contains(Channels.R) ? center.r + amplitude.r * Mathf.Sin(frequency.r * Time.time + offset) : color.r;
color.g = channels.Contains(Channels.G) ? center.g + amplitude.g * Mathf.Sin(frequency.g * Time.time + offset) : color.g;
color.b = channels.Contains(Channels.B) ? center.b + amplitude.b * Mathf.Sin(frequency.b * Time.time + offset) : color.b;
color.a = channels.Contains(Channels.A) ? center.a + amplitude.a * Mathf.Sin(frequency.a * Time.time + offset) : color.a;
return color;
}