mirror of
https://github.com/alopexc0de/pixopixel.git
synced 2024-11-14 15:17:26 +00:00
Add "Scanline"-style image transition
This will switch the display from one image to another, one pixel at a time. The speed can be controlled via the `anitime` argument.
This commit is contained in:
parent
2a3d075a81
commit
ac533e2147
@ -29,9 +29,12 @@ Adafruit_DotStarMatrix matrix = Adafruit_DotStarMatrix(
|
||||
DOTSTAR_BGR);
|
||||
|
||||
|
||||
|
||||
void setup(void) {
|
||||
matrix.begin();
|
||||
matrix.setBrightness(BRIGHTNESS);
|
||||
|
||||
scanChangeImage(darkness, sh, 1000, 10);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
@ -41,6 +44,10 @@ void loop() {
|
||||
|
||||
showImage(twitter, 1000);
|
||||
notifyPopupImg(glogo, 500);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* showImage, displays an image to the display with no animation
|
||||
* args:
|
||||
@ -96,4 +103,29 @@ void notifyPopupImg(int img[256][3], int dlytime) {
|
||||
matrix.fillScreen(0);
|
||||
matrix.show();
|
||||
}
|
||||
// "Animation" or picture transition functions
|
||||
|
||||
/*
|
||||
* scanChangeImage, Change from one image to another with a scanline appearence
|
||||
* args:
|
||||
* - src[256][3] - Standard Pixo-Style icon that we Change from, displayed all at once
|
||||
* - dst[256][3] - Standard Pixo-Style icon that we Change to, displayed one pixel at a time
|
||||
* - dlytime - The amount of time (in ms) to keep the image on the display
|
||||
* - anitime - The amount of time (in ms) between drawing each pixel during the Changeition; the lower this number, the faster the Changeition
|
||||
*/
|
||||
void scanChangeImage(int src[256][3], int dst[256][3], int dlytime, int anitime) {
|
||||
for (int i=0; i<256; i++){
|
||||
matrix.setPixelColor(i, src[i][0], src[i][1], src[i][2]);
|
||||
}
|
||||
matrix.show();
|
||||
|
||||
delay(dlytime);
|
||||
|
||||
for (int i=0; i<256; i++){
|
||||
matrix.setPixelColor(i, dst[i][0], dst[i][1], dst[i][2]);
|
||||
matrix.show();
|
||||
delay(anitime);
|
||||
}
|
||||
|
||||
delay(dlytime);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user