Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set Ripples to select color from set list #8

Open
TomWaterz opened this issue Oct 1, 2021 · 1 comment
Open

Set Ripples to select color from set list #8

TomWaterz opened this issue Oct 1, 2021 · 1 comment

Comments

@TomWaterz
Copy link

Can someone help me figure out how to generate ripple colors from a set array of color values? I've tried doing it but can't seem to figure out how the color wheel works.

I have something like this

char colorOptions[3] = {'#FFA233', '#DC0000', '#8F00AB'};

and just want each ripple to randomly choose a color from this array.

@EasyAsABC123
Copy link

EasyAsABC123 commented Feb 8, 2023

Here are the code locations where colors are chosen:
randomPulse color generation
cubePulse color selection
starburst color selection

These all rely on baseColor, which is randomly generated on this line

If you switch out baseColor with a random selection from your array this should "work".

unsigned int baseColor = colorOptions[random(NUMBER_OF_COLORS)];

Minor correction to your array declaration, we also would need some code to convert from these hex values to their int counterpart (not shown in my examples).

    const int NUMBER_OF_COLORS = 3;
    const char* colorOptions[] = {"#FFA233", "#DC0000", "#8F00AB"};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants