0

Hallowing Snow Globe?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Hallowing Snow Globe?

by Jenizma on Sun Nov 25, 2018 3:20 pm

I would like to make my Hallowing into a mini snow globe. How do I design an animation that can be uploaded to my Hallowing and run as a snow globe? I am a VERY novice tinkerer and honestly don’t have any skills beyond block coding (I’m an elementary school librarian) but it seems like this should be doable. Are there any tutorials to produce an an animation that can run on my Adabox 09 Hallowing?

Jenizma
 
Posts: 2
Joined: Sun Nov 25, 2018 2:21 pm

Re: Hallowing Snow Globe?

by adafruit_support_mike on Mon Nov 26, 2018 3:06 am

It's possible, but not a beginner-level project.

The problem is that loading a full display's worth of information is slow, and will only display the fixed sequence of images. If you want a project where the bits of snow are more interactive, you'll have to draw and erase snowflake pixels over a background image.

The Hallowing's external Flash chip has enough memory to hold a background image, and is fast enough to let you read specific pixels and restore them after covering them with a snowflake, but handling the bookkeeping is a mid-level programming problem.

The first step would be to write code that finds the three bytes that correspond to an X-Y pixel coordinate in a bitmap stored in Flash. The next step would be to use that to build code that can locate the pixel data for a small rectangle somewhere on the screen. Then you can use that to draw a white rectangle somewhere on the screen, then replace it with the original bitmap pixels. Then comes moving the rectangle around on the screen and replacing the background pixels that have been covered so it looks like the rectangle is moving around over the image.

From there, you can play with different ways to represent a snowflake, and increase the number of snowflakes moving around on the screen. At that point it turns into a research project as you learn how long it takes to erase and move N pixels per frame of animation.

adafruit_support_mike
 
Posts: 54144
Joined: Thu Feb 11, 2010 2:51 pm

Re: Hallowing Snow Globe?

by Jenizma on Mon Nov 26, 2018 5:11 am

You are right, that sounds like a “goal” and not a “my current ability” project. Is there an easy way just to run a little looping animation?

Jenizma
 
Posts: 2
Joined: Sun Nov 25, 2018 2:21 pm

Re: Hallowing Snow Globe?

by adafruit_support_mike on Wed Nov 28, 2018 5:28 am

You can load multiple bitmap images into the external Flash, then draw those to the display one after another. I'm afraid we don't have any code that demonstrates that directly though.

adafruit_support_mike
 
Posts: 54144
Joined: Thu Feb 11, 2010 2:51 pm

Re: Hallowing Snow Globe?

by lisleman on Tue Dec 04, 2018 2:27 pm

I found the info in this post informative. I'm thinking features like this is why graphic processing unit (GPU) chips were made.

lisleman
 
Posts: 79
Joined: Wed Aug 06, 2014 5:53 pm

Re: Hallowing Snow Globe?

by adafruit_support_mike on Wed Dec 05, 2018 7:15 am

GPUs do a bit more. They're mostly SIMD (Single Instruction/Multiple Data) engines.

An enormous amount of graphics processing involves simple math operations on large sets of data.. compositing for transparency inolves adding X% of the front pixel's value to 100-X% of the pixel behind it, for instance. Doing that one pixel at a time would be unbearably slow for a 2880x1800 display (nearly 15MB per layer).

SIMD engines have huge arrays of simple math and logic circuits, so operations like, "multiply all the values in this 1MB buffer by 0.8" becomes a one-step instruction performed by 2^20 calculators acting in parallel. They can also handle operations like, "move all the bytes in this region of memory to that region" as a single step.

The SAMD51, used in our M4 boards, has a smaller version of the same thing called a DSP (Digital Signal Processing array).

adafruit_support_mike
 
Posts: 54144
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.