internal SCANuiColorPicker (Color low, Color high, bool changeLow) { colorLow = c= low; c = colorLow.maxBright(); colorHigh = high; lowColorChange = oldColorState = changeLow; valSlider = oldValSlider = colorLow.Brightness().Mathf_Round(2) * 100f; }
/** Generates a sequence of colors where the next color is a random offset from the previous color. @param colorCount The number of colors to generate @param startColor The first color in the sequence @param */ public static List<Color> GenerateRandomWalk( int colorCount, Color startColor, float minOffset, float maxOffset, bool fixLightness) { var colors = new List<Color>(); var newColor = startColor; for (int i = 0; i < colorCount; i++) { var amplitude = minOffset + (maxOffset - minOffset) * Random.value; var offset = amplitude * Random.onUnitSphere; newColor = new Color( Mathf.Clamp01(newColor.r + offset.x), Mathf.Clamp01(newColor.g + offset.y), Mathf.Clamp01(newColor.b + offset.z)); colors.Add(newColor); } if (fixLightness) { var brightness = startColor.Brightness(); return colors.Select(color => color.WithBrightness(brightness)).ToList(); } return colors; }