e:cue Forum › Foren › English Discussion Forums › SYMPHOLIGHT (E) › Random RGB effect
Schlagwörter: random RGB
- Dieses Thema hat 1 Antwort und 2 Teilnehmer, und wurde zuletzt aktualisiert vor 3 Jahre, 4 Monaten von
Christoph Paduch.
-
AutorBeiträge
-
-
25. October 2019 um 10:16 Uhr #247162
Robbert Mak
TeilnehmerHi,
where can I find a truly random rgb effect?
Thanks again.
Robbert
-
4. November 2019 um 8:58 Uhr #247167
Christoph Paduch
ModeratorHello Robbert, the particle and noise effects are random. That has also disadvantages, because you cannot loop them in an easy way.
Or do you only want to create a random color or random color changes?
Then you can use scripting for creating the next color and set the color in the effect.Here an example to create a random number:
using System;
using Scripting;public static class RandomNumber
{
private static Random rnd = new Random();// returns a Random number including the min and max value
public static int Run(int min, int max)
{
return rnd.Next(min, max+1);
}
}
And an example to create a color from the color temperature in range 0..360°:
using System;
using Scripting;
using Ecue.Base.Data.Rendering;/// <summary>
/// Example without warranty.
/// Takes a ColorTemperature in the range 0..360° like the colors in the Color Picker Wheel and calculates the RGB parts and a corresponding ProPhotoColor.
/// </summary>
public static class ColorConvert
{
public static void Run(double colorTemperature, out int red, out int green, out int blue, out ProPhotoColor color)
{
red = 0;
blue = 0;
green = 0;//calculate blue
if (colorTemperature >= 90 && colorTemperature <= 210)
{
blue = 255;
}
else if (colorTemperature < 90 && colorTemperature > 30)
{
blue = (int)( Math.Abs(colorTemperature - 30.0)*4.25);
}
else if (colorTemperature > 210 && colorTemperature < 270)
{
blue = (int)( Math.Abs(colorTemperature - 270.0)*4.25);
}//calculate green
if (colorTemperature <= 90 || colorTemperature >= 330)
{
green = 255;
}
else if (colorTemperature < 150)
{
green = (int)( Math.Abs(colorTemperature - 150.0)*4.25);
}
else if (colorTemperature > 270)
{
green = (int)( Math.Abs(colorTemperature -270.0)*4.25);
}//calculate red
if (colorTemperature <= 330 && colorTemperature >= 210)
{
red = 255;
}
else if (colorTemperature > 150 && colorTemperature < 210)
{
red = (int)(Math.Abs(colorTemperature - 150.0)*4.25);
}
else if (colorTemperature < 30 )
{
red = (int)( Math.Abs(colorTemperature - 30.0)*4.25);
}
else if (colorTemperature > 330 )
{
red = (int)( Math.Abs(colorTemperature - 390.0)*4.25);
}color = new ProPhotoColor((float)(red / 255.0), (float)(green/ 255.0), (float)(blue/ 255.0), 1f);
}
}
I hope this helps to realize your ideas.
Kind regards / Freundliche Grüße
Christoph Paduch
-
-
AutorBeiträge
- Du musst angemeldet sein, um auf dieses Thema antworten zu können.