-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHiRez.cpp
63 lines (50 loc) · 1.43 KB
/
HiRez.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//
// HiRez.cpp
// GauntletII
//
// Created by Robert Atkins on 26/09/13.
// Copyright (c) 2013 Robert Atkins. All rights reserved.
//
#import "Effect.h"
class HiRez : public Effect {
private:
uint16_t hiWidth, hiHeight;
uint8_t hue;
public:
HiRez(CRGB *leds, int width, int height): Effect(leds, width, height),
hue(0),
hiWidth(256 * width),
hiHeight(256 * height)
{
}
void start() {
lo();
hi();
}
void lo() {
for (int x = 0; x < width; x++) {
pixel(x - 1, 0) = CHSV(hue, 255, 255);
pixel(x, 0) = CHSV(hue, 255, 255);
pixel(x + 1, 0) = CHSV(hue, 255, 255);
LEDS.show();
delay(64);
pixel(x - 1, 0) = CRGB::Black;
pixel(x, 0) = CRGB::Black;
pixel(x + 1, 0) = CRGB::Black;
}
}
//
// x x x x | x x x x | x x x x | x x x x
void hi() {
for (uint16_t x = 1; x < hiWidth; x+= 32) {
uint16_t actual = x >> 8;
pixel(actual - 1, 0) = CHSV(hue, 255, 255 - x & 0xFF);
pixel(actual, 0) = CHSV(hue, 255, 255);
pixel(actual + 1, 0) = CHSV(hue, 255, x & 0xFF);
LEDS.show();
pixel(actual - 1, 0) = CHSV(hue, 0, 0);
pixel(actual, 0) = CHSV(hue, 0, 0);
pixel(actual + 1, 0) = CHSV(hue, 0, 0);
}
}
};