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

Add RGB spheres animation #13

Merged
merged 4 commits into from
Jan 17, 2021
Merged

Conversation

NeunEinser
Copy link
Contributor

This adds a script that will simulate RGB spheres.

3 spheres are created. Each of the 3 spheres represents one of the RGB primary colors.

During the initialization, the origin of each sphere is chosen such that they are approximately as far away from each other as possible.
Each origin will be at one of the given LED coordinates.

The sphere’s radii will increase and decrease during the animation. The initial radius is chosen at random for each sphere.
For each enlarge or shrinking cycle, the green sphere uses 120 animation frames the red sphere uses 160 frames, and the blue sphere uses 200 frames

Each RGB color component is calculated using the distance to the corresponding sphere. Specifically, the formular used is 255 * (1 - dist / max_dist) ^ 3, where max_dist is the maximum distance any of the LED can have from the sphere.

The sphere changes from enlarging to shrinking, when the current radius is approximately equal to its max_dist.
It switches back to enlarging, once its current radius is approximately 0.

I tested this already using the simulator provided in #5.

@NeunEinser NeunEinser changed the title Rgb spheres Add RGB spheres animation Dec 25, 2020
@oliverdunk
Copy link
Member

Hey @NeunEinser! Matt asked if I could help with maintaining this repository, so I've been thinking about how best to do that. I've decided to create an examples folder where we can add contributions like this one - you can find some more information in the README.

Would you be up for updating your PR, to move your effect in to the examples folder?

@NeunEinser
Copy link
Contributor Author

Sure :)

@oliverdunk
Copy link
Member

Thanks!

@oliverdunk oliverdunk merged commit 6e0a602 into standupmaths:main Jan 17, 2021
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

Successfully merging this pull request may close these issues.

2 participants