zoukankan      html  css  js  c++  java
  • 一个类似与地平线中的车漆画板制作

    效果图

      public void SetCarPaintColor()
        {
            //初始化行数列数
            int Hcount = 0;
            int Vconut = 0;
            Hcount = 17; //17列(由共同的线性特点的列数)
            Vconut = 9;  //9行
            for (int z = 0; z < Vconut; z++)
            {
                //第一列比较特殊首先生成第一列
                var MaintColor = Color.HSVToRGB(0, 0, ((z + 1) / 9.0f));
                //Img是一张图片
                var obj = Instantiate(Img);
                obj.GetComponent<Image>().color = MaintColor;
                obj.transform.parent = parentTransform;
            }
            //生成后面的所有
            for (int i = 0; i < Hcount; i++)
            {
                for (int j = 0; j < Vconut; j++)
                {
                    float h = (i + 1) * (360 / Hcount);
                    float v = (j + 1) * (100f / (Vconut % 2 == 0 ? Vconut / 2 : Vconut / 2 + 1));
                    float s = 1;
                    var MaintColor = Color.HSVToRGB(h / 360, 1, v / 100);
                    if (j > (Vconut / 2))
                    {
                        s = (1 * (Vconut-1 - j)) / (Vconut / 2f);
                        if (s <= 0.1f)
                            s = 0.1f;
                        MaintColor = Color.HSVToRGB(h / 360, s, 1);
                    }
                    var obj = Instantiate(Img);
                    obj.GetComponent<Image>().color = MaintColor;
                    obj.transform.parent = parentTransform;
                }
            }
        }
    

      

  • 相关阅读:
    树世界
    清空 NumericUpDown
    没有评论的日子
    GetData.cs

    Hashtable 在程序中控制重复项
    Convert.ToInt32() VS System.Int32.Parse()
    饮食九要素
    添加 or 修改 的一个处理方式
    一个关于 电话号码 的正则表达式
  • 原文地址:https://www.cnblogs.com/mafeihao/p/11381596.html
Copyright © 2011-2022 走看看