Background snow fall effect in CircuitPython

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Azzura
 
Posts: 33
Joined: Mon Nov 29, 2021 9:20 pm

Background snow fall effect in CircuitPython

Post by Azzura »

Hi, Xmas is coming fast, seeking support for code to animate continuous background snow fall effect in CircuitPython.
I have built a frame to fit in my window that supports 4 panels each 64 X 32, installed, wired and tested ready to go. However my CircuitPython code skills are not as good as my wiring skills. I am finding it difficult to write CircuitPython code to animate continuous snow fall.
Eventually I wish to have Merry Xmas text scrolling across the snow fall effect, but at this time I need the snow fall code. Anyone care to share CircuitPython continuous snow fall code?

User avatar
adafruit_support_carter
 
Posts: 29159
Joined: Tue Nov 29, 2016 2:45 pm

Re: Background snow fall effect in CircuitPython

Post by adafruit_support_carter »

There's some code here that might help:
https://learn.adafruit.com/circuit-play ... snow-globe

User avatar
Azzura
 
Posts: 33
Joined: Mon Nov 29, 2021 9:20 pm

Re: Background snow fall effect in CircuitPython

Post by Azzura »

Hi, thanks for the quick reply, appreciate the advice on the snow globe using the "adafruit_circuitplayground/// cpx" coding proposal.

Question:
What is the difference using the adafruit_circuitplayground cpx coding concept rather than using the matrix = rgbmatrix.RGBMatrix display concept. Does the RGBMatrix coding strategy offer more options to coding than the adafruit_circuitplayground?

User avatar
adafruit_support_carter
 
Posts: 29159
Joined: Tue Nov 29, 2016 2:45 pm

Re: Background snow fall effect in CircuitPython

Post by adafruit_support_carter »

The OLED and the Matrix are both just displays. You'd need to adapt the code for use on the RGB Matrix. But you could reuse the snow generating parts of the code.

User avatar
Azzura
 
Posts: 33
Joined: Mon Nov 29, 2021 9:20 pm

Re: Background snow fall effect in CircuitPython

Post by Azzura »

Thank you, sometimes the jargon eludes me. However I am tenacious, I will try to adapt the code; I have not pulled all of my hair out yet, so I'll try the RGB Matrix coding.

User avatar
adafruit_support_carter
 
Posts: 29159
Joined: Tue Nov 29, 2016 2:45 pm

Re: Background snow fall effect in CircuitPython

Post by adafruit_support_carter »

Start with examples that are for the RGB matrix. That'll help you become familiar with the basic way of displaying things on the matrix. And just using the matrix in general. Then move to trying to adapt the snow code for the matrix.

EDIT This may help also. It's a quick port I did a few months ago. It may still need some changes for your specific setup, but at least it provides some reference code that is driving an RGB matrix:
https://github.com/caternuson/MatrixPor ... ix_snow.py

User avatar
Azzura
 
Posts: 33
Joined: Mon Nov 29, 2021 9:20 pm

Re: Background snow fall effect in CircuitPython

Post by Azzura »

Hi, really appreciated the advise on the coding and the direction to the examples ie, rain, snow etc. Used the snow example, amended the code to have a continuous snow fall event. Now I wish to add animations such as reindeer, mountains, trees etc in the falling snow. Any ideas?
Super helpful code it allowed me to get a handle on what I could achieve ... thanks
only needed the snow falling not the accumulation, so appreciative cheers
only needed the snow falling not the accumulation, so appreciative cheers
Continuous Snow fall by Carter.png (526.06 KiB) Viewed 267 times

User avatar
adafruit_support_carter
 
Posts: 29159
Joined: Tue Nov 29, 2016 2:45 pm

Re: Background snow fall effect in CircuitPython

Post by adafruit_support_carter »

If you want those things to be static, then it's easy - just add them as a new layer into the display group. The animated snow would then be a separate layer, essentially what you already have in place.

If you want them to actually be animated, it'll be more work. Do you want snow and other things to animate at different rates? etc.

This guide may be useful as a demonstration of how to do animations using "sprite sheet":
https://learn.adafruit.com/tombstone-ma ... on-display

User avatar
Azzura
 
Posts: 33
Joined: Mon Nov 29, 2021 9:20 pm

Re: Background snow fall effect in CircuitPython

Post by Azzura »

Hi, further to the sprite concept, I have played with them and yes it is a lot of work. In my mind the video I see is composed of fast images of snowfall then animated sprite image then snowfall then sprite image etc A bit like a video however the eye sees both images simultaneously not the rapid image changes. Is this practicle or is there a simpler concept available.

I really appreciate all of your feedback.

User avatar
Azzura
 
Posts: 33
Joined: Mon Nov 29, 2021 9:20 pm

Re: Background snow fall effect in CircuitPython

Post by Azzura »

Hi Carter, your continuous snow program is working great.

Snowfall rising from the ground:
I have 4 panels working now large rectangular format, and it is looking like a snow storm, ha ha. One problem is I need to tell the program that panels 3 and 4 have been rotated to make the wiring simple, but now I need to stop the snow from rising up from the ground. I believe the "serpentine" command needs to be incorporated into the matrix definition, just not sure how and where. Currently all snow is travelling to the middle of the 4 panels, very spectacular but somewhat surreal.
A hint would be appreciated.

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”