当前位置: 首页>>代码示例>>C#>>正文


C# Channels.Contains方法代码示例

本文整理汇总了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;
        }
开发者ID:Magicolo,项目名称:No-Love-No-Gain,代码行数:31,代码来源:ColorExtensions.cs

示例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;
        }
开发者ID:Magicolo,项目名称:No-Love-No-Gain,代码行数:9,代码来源:ColorExtensions.cs

示例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;
        }
开发者ID:Magicolo,项目名称:No-Love-No-Gain,代码行数:9,代码来源:ColorExtensions.cs

示例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;
        }
开发者ID:Magicolo,项目名称:No-Love-No-Gain,代码行数:9,代码来源:ColorExtensions.cs

示例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;
        }
开发者ID:Magicolo,项目名称:No-Love-No-Gain,代码行数:9,代码来源:ColorExtensions.cs

示例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;
        }
开发者ID:Magicolo,项目名称:No-Love-No-Gain,代码行数:9,代码来源:ColorExtensions.cs

示例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;
        }
开发者ID:Magicolo,项目名称:No-Love-No-Gain,代码行数:9,代码来源:ColorExtensions.cs


注:本文中的Channels.Contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。