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


C# Gradient类代码示例

本文整理汇总了C#中Gradient的典型用法代码示例。如果您正苦于以下问题:C# Gradient类的具体用法?C# Gradient怎么用?C# Gradient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Gradient类属于命名空间,在下文中一共展示了Gradient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Update

	// Update is called once per frame
	void Update () {
    if (timer == 0) {
      LastColor = SoupMaterial.color;
    }

    if (!NextColor.Equals(SoupMaterial.color)) {
      timer += Time.deltaTime;
      Color c = Color.Lerp(LastColor, NextColor, timer / duration);
      SoupMaterial.color = c;
      SoupLight.color = c;
      SoupLight.intensity = Mathf.Max(1.5f * (duration - timer), 1);

      var col = Smoke.colorOverLifetime;
      col.enabled = true;

      Gradient grad = new Gradient();
      grad.SetKeys( new GradientColorKey[] { new GradientColorKey(c, 0.0f), new GradientColorKey(Color.gray, 1.0f) }, new GradientAlphaKey[] { new GradientAlphaKey(1.0f, 0.0f), new GradientAlphaKey(0.0f, 1.0f) } );

      col.color = new ParticleSystem.MinMaxGradient(grad);

      if (timer >= duration) {
        SoupMaterial.color = NextColor;
        SoupLight.intensity = 1;
        timer = 0;
      }
    }
	}
开发者ID:HarrisonHough,项目名称:TheCauldrenRepo,代码行数:28,代码来源:SoupColor.cs

示例2: Start

    // Use this for initialization
    void Start()
    {
        //activated = true;
        //cachedY = timeTransform.position.y;

        minXValue = 0;
        maxXValue = timeTransform.rect.width;

        //currentTime = maxTime;
        g = new Gradient();

        // Populate the color keys at the relative time 0 and 1 (0 and 100%)
        gck = new GradientColorKey[3];
        gck[0].color = new Color32(9,183,62,1);
        gck[0].time = 0.0f;
        gck[1].color = new Color32(255,228,0,1);
        gck[1].time = 0.5f;
        gck[2].color = new Color32(219,101,63,1);
        gck[2].time = 1.0f;

        // Populate the alpha  keys at relative time 0 and 1  (0 and 100%)
        gak = new GradientAlphaKey[2];
        gak[0].alpha = 1.0f;
        gak[0].time = 0.0f;
        gak[1].alpha = 1.0f;
        gak[1].time = 1.0f;
        g.SetKeys(gck, gak);

        CurrentTime = maxTime;
    }
开发者ID:daolf,项目名称:flyhigher,代码行数:31,代码来源:TimeBarscript.cs

示例3: LoadData

        private void LoadData(object sender, EventArgs e)
        {
            Gradient gradient = new Gradient(9, 0.01, 2.0, 10, 1.5);

            chart1.Series["Series1"].ChartType = SeriesChartType.Spline;

            gradient.SetStartPoint();

            double length = 0.0;
            int i = 0;
            do 
            {
                length = gradient.GetNext();
                chart1.Series["Series1"].Points.AddXY(i, length);
                i++;
            } while (length > epsilon && i < maxIteration);

            Console.WriteLine("\nIteration = " + (i - 1));
            Console.WriteLine("Distance between atoms = " + gradient.GetPoint() + "\n");

            chart1.ChartAreas[0].AxisX.Minimum = 0;
            chart1.ChartAreas[0].AxisY.Minimum = 0;

            chart1.Update();
        }
开发者ID:LukaszZapala,项目名称:Simulation-Methods-in-Nanotechnology,代码行数:25,代码来源:ChartView.cs

示例4: GradientPresets

        /// <summary>
        /// Initializes a new instance of Gradient.
        /// </summary>
        static GradientPresets()
        {
            // Grayscale gradient color keys
            var grayscaleColorKeys = new List<GradientColorKey>
            {
                new GradientColorKey(Color.black, 0),
                new GradientColorKey(Color.white, 1)
            };

            // RGB gradient color keys
            var rgbColorKeys = new List<GradientColorKey>
            {
                new GradientColorKey(Color.red, 0),
                new GradientColorKey(Color.green, 0.5f),
                new GradientColorKey(Color.blue, 1)
            };

            // RGBA gradient color keys
            var rgbaColorKeys = new List<GradientColorKey>
            {
                new GradientColorKey(Color.red, 0),
                new GradientColorKey(Color.green, 1 / 3f),
                new GradientColorKey(Color.blue, 2 / 3f),
                new GradientColorKey(Color.black, 1)
            };

            // RGBA gradient alpha keys
            var rgbaAlphaKeys = new List<GradientAlphaKey> {new GradientAlphaKey(0, 2 / 3f), new GradientAlphaKey(1, 1)};

            // Terrain gradient color keys
            var terrainColorKeys = new List<GradientColorKey>
            {
                new GradientColorKey(new Color(0, 0, 0.5f), 0),
                new GradientColorKey(new Color(0.125f, 0.25f, 0.5f), 0.4f),
                new GradientColorKey(new Color(0.25f, 0.375f, 0.75f), 0.48f),
                new GradientColorKey(new Color(0, 0.75f, 0), 0.5f),
                new GradientColorKey(new Color(0.75f, 0.75f, 0), 0.625f),
                new GradientColorKey(new Color(0.625f, 0.375f, 0.25f), 0.75f),
                new GradientColorKey(new Color(0.5f, 1, 1), 0.875f),
                new GradientColorKey(Color.white, 1)
            };

            // Generic gradient alpha keys
            var alphaKeys = new List<GradientAlphaKey> {new GradientAlphaKey(1, 0), new GradientAlphaKey(1, 1)};

            _empty = new Gradient();

            _rgb = new Gradient();
            _rgb.SetKeys(rgbColorKeys.ToArray(), alphaKeys.ToArray());

            _rgba = new Gradient();
            _rgba.SetKeys(rgbaColorKeys.ToArray(), rgbaAlphaKeys.ToArray());

            _grayscale = new Gradient();
            _grayscale.SetKeys(grayscaleColorKeys.ToArray(), alphaKeys.ToArray());

            _terrain = new Gradient();
            _terrain.SetKeys(terrainColorKeys.ToArray(), alphaKeys.ToArray());
        }
开发者ID:Andros-Spica,项目名称:LibNoise.Unity,代码行数:62,代码来源:GradientPresets.cs

示例5: CreateVerticalGradient

        /// <summary>
        /// Creates a 1 pixel wide vertical gradient texture using the provided <see cref="GradientStop"/> array.
        /// </summary>
        /// <param name="device"><see cref="Microsoft.Xna.Framework.Graphics.GraphicsDevice"/> instance to use.</param>
        /// <param name="gradientStops">Array of <see cref="GradientStop"/> instances to use when generating the gradient.</param>
        /// <param name="height">Height of the generated texture in pixels.</param>
        /// <returns>A texture 1 pixel wide and the height specified.</returns>
        public static Texture2D CreateVerticalGradient(GraphicsDevice device, Gradient gradient, int height)
        {
            Texture2D texture = new Texture2D(device, 1, height, false, SurfaceFormat.Color);
            Color[] colors = gradient.GetColors(height);
            texture.SetData<Color>(colors);

            return texture;
        }
开发者ID:bigangryguy,项目名称:BrassKnuckles,代码行数:15,代码来源:SimpleTexture.cs

示例6: CreateHorizontalGradient

        /// <summary>
        /// Creates a 1 pixel high horizontal gradient texture using the provided <see cref="GradientStop"/> array.
        /// </summary>
        /// <param name="device"><see cref="Microsoft.Xna.Framework.Graphics.GraphicsDevice"/> instance to use.</param>
        /// <param name="gradientStops">Array of <see cref="GradientStop"/> instances to use when generating the gradient.</param>
        /// <param name="width">Width of the generated texture in pixels.</param>
        /// <returns>A texture with the width specified and 1 pixel high.</returns>
        public static Texture2D CreateHorizontalGradient(GraphicsDevice device, Gradient gradient, int width)
        {
            Texture2D texture = new Texture2D(device, width, 1, false, SurfaceFormat.Color);
            Color[] colors = gradient.GetColors(width);
            texture.SetData<Color>(colors);

            return texture;
        }
开发者ID:bigangryguy,项目名称:BrassKnuckles,代码行数:15,代码来源:SimpleTexture.cs

示例7: SceneFilter

        public SceneFilter(float angle, Gradient gradient)
        {
            gradientFx = new GradientFilter();
            gradientFx.Gradientf = gradient;
            gradientFx.OriginAngleDegree = angle;

            saturationFx = new SaturationModifyFilter();
            saturationFx.SaturationFactor = -0.6f;
        }
开发者ID:olachan,项目名称:ImageFilterForWindowsPhone,代码行数:9,代码来源:SceneFilter.cs

示例8: SaveGraient

	void SaveGraient(Gradient gradient)
	{
		var path = EditorUtility.SaveFilePanel("Save gradient.", "Assets/", "", "asset");
		if (!string.IsNullOrEmpty(path))
		{
			GradientObject obj = GradientObject.CreateInstance<GradientObject>();
			obj.data = gradient;
			AssetDatabase.CreateAsset(obj, LocalPath(path));
		}
	}
开发者ID:fengqk,项目名称:Art,代码行数:10,代码来源:MaterialColorPropertyDrawer.cs

示例9: AddGradient_Click

 private void AddGradient_Click(object sender, EventArgs e)
 {
     Gradient newGradient = new Gradient();
       newGradient.Name = CreateUniqueGradientName(Strings.NewGradient);
       gradients.Add(newGradient);
       gradientList.DataSource = null;
       gradientList.DataSource = gradients;
       gradientList.SelectedIndex = gradients.Count - 1;
       deleteGradient.Enabled = (gradients.Count > 0);
       gradientNameTextbox.Focus();
 }
开发者ID:romanbdev,项目名称:quickroute-gps,代码行数:11,代码来源:GradientEditor.cs

示例10: ExtendedTerrainArea

    public ExtendedTerrainArea(float averageHeight, float flatness, float roughness, 
	                                  Gradient coloring00, Gradient coloring10, Gradient coloring01, Gradient coloring11,
	                                  float deltaX, float deltaY)
        : base(averageHeight, flatness, roughness, null)
    {
        this.coloring00 = coloring00;
        this.coloring10 = coloring10;
        this.coloring01 = coloring01;
        this.coloring11 = coloring11;
        this.deltaX = deltaX;
        this.deltaY = deltaY;
    }
开发者ID:parmandorc,项目名称:PCG,代码行数:12,代码来源:ExtendedTerrainArea.cs

示例11: GradientViewer

        // This constructor takes a Gradient value from the
        // design-time environment, which will be used to display
        // the initial state.
        public GradientViewer(Gradient gradient, IWindowsFormsEditorService editorService)
        {
            // This call is required by the designer.
              InitializeComponent();

              // Cache the light shape value provided by the
              // design-time environment.
              this.gradient = gradient;

              // Cache the reference to the editor service.
              this.editorService = editorService;
        }
开发者ID:romanbdev,项目名称:quickroute-gps,代码行数:15,代码来源:GradientViewer.cs

示例12: InitImpulseGradient

	private void InitImpulseGradient ()
	{
		impulseGradient = new Gradient ();
		GradientColorKey[] gck = new GradientColorKey[impulseGradientColors.Length];
		GradientAlphaKey[] gak = new GradientAlphaKey[impulseGradientColors.Length];
		for (int i = 0; i < impulseGradientColors.Length; i++) {
			gck [i].color = impulseGradientColors [i];
			gak [i].alpha = 1.0f;
			gck [i].time = gak [i].time = impulseGradientTimes [i];
		}
		impulseGradient.SetKeys (gck, gak);
	}
开发者ID:eriol1977,项目名称:Bullseye,代码行数:12,代码来源:UIControl.cs

示例13: WindParticle

	private int id; // just for debugging / can be deleted after

	#endregion

	public WindParticle(int _id, Vector3 _position, int _maxDistance, Quaternion _direction, float _speed, int _maxMountainHeight, float _temperature, float _saturation, Gradient _colorArea) {
		id = _id;
		position = _position;
		source = _position;
		maxDistance = _maxDistance;
		direction = _direction;
		speed = _speed;
		maxMountainHeight = _maxMountainHeight;
		temperature = _temperature;
		saturation = getSFromFRel(_saturation,getPFromHeight((position.y-groundHeight)/scale),temperature); // saturation kommt als relative Luftfeuchte, daher die Umrechnung
		colorArea = _colorArea;
		visible = true;
	}
开发者ID:tim-peters,项目名称:TheFoehnThing,代码行数:17,代码来源:WindParticle.cs

示例14: Awake

		// Use this for initialization
		void Awake () 
		{
		
			//set RectTransform parameters
			RectTransform rectTransform = this.GetComponent<RectTransform> ();
			rectTransform.anchorMin = new Vector2(0,0);
			rectTransform.anchorMax = new Vector2(1,1);
			rectTransform.anchoredPosition = new Vector2(1,1);

			colorGradient = GetColorGradient (bottomColor, topColor); // create the color gradient

	
		}
开发者ID:gcanedo,项目名称:globalgamejam2016,代码行数:14,代码来源:PanelWaveform.cs

示例15: BlendGradient

    public Gradient BlendGradient(Gradient terrain_gradient, Gradient object_gradient)
    {
        List<ColorHSV> targetPalette = new List<ColorHSV>();
        List<ColorHSV> currentPalette = new List<ColorHSV>();
        targetPalette = RandomE.TetradicPalette(0.25f, 0.75f);
        Debug.Log(targetPalette.Count);
        ColorHSV groundColor = new ColorHSV(terrain_gradient.Evaluate(0));
        ColorHSV newColor = new ColorHSV(object_gradient.Evaluate(1));
        targetPalette.Add(ColorHSV.Lerp(groundColor, newColor, 0.5f));
        var gradient = ColorE.Gradient(from: targetPalette[2].WithSV(0.8f, 0.8f),
            to: targetPalette[3].WithSV(0.8f, 0.8f));

        return object_gradient;
    }
开发者ID:emomper23,项目名称:PsychVR,代码行数:14,代码来源:ObjectColorSetter.cs


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