Allow different speed animations for each light in spooky and eerie
This commit is contained in:
parent
aefb2184bf
commit
cf21388bd8
118
lantern/main.c
118
lantern/main.c
|
@ -149,77 +149,69 @@ void lantern_start_normal(lantern_t *self, rng_t *rng, int light_idx) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
void lantern_start_spooky(lantern_t *self, rng_t *rng, int light_idx) {
|
||||||
void lantern_start_spooky(lantern_t *self, rng_t *rng) {
|
switch (light_idx) {
|
||||||
animation_begin(
|
case 0:
|
||||||
&self->animations[0],
|
animation_begin(
|
||||||
0,
|
&self->animations[0],
|
||||||
random_step(self->animations[0].color.g, 80, 120, rng),
|
0,
|
||||||
0,
|
random_step(self->animations[0].color.g, 80, 120, rng),
|
||||||
15);
|
0,
|
||||||
animation_begin(
|
15);
|
||||||
&self->animations[1],
|
break;
|
||||||
0,
|
case 1:
|
||||||
random_step(self->animations[1].color.g, 60, 100, rng),
|
animation_begin(
|
||||||
0,
|
&self->animations[1],
|
||||||
15);
|
0,
|
||||||
animation_begin(
|
random_step(self->animations[1].color.g, 60, 100, rng),
|
||||||
&self->animations[2],
|
0,
|
||||||
0,
|
15);
|
||||||
random_step(self->animations[2].color.g, 20, 40, rng),
|
break;
|
||||||
0,
|
case 2:
|
||||||
15);
|
animation_begin(
|
||||||
|
&self->animations[2],
|
||||||
|
0,
|
||||||
|
random_step(self->animations[2].color.g, 20, 40, rng),
|
||||||
|
0,
|
||||||
|
15);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void lantern_start_eerie(lantern_t *self, rng_t *rng) {
|
void lantern_start_eerie(lantern_t *self, rng_t *rng, int light_idx) {
|
||||||
animation_begin(
|
switch (light_idx) {
|
||||||
&self->animations[0],
|
case 0:
|
||||||
random_step(self->animations[0].color.g, 20, 40, rng),
|
animation_begin(
|
||||||
random_step(self->animations[0].color.g, 20, 40, rng),
|
&self->animations[0],
|
||||||
random_step(self->animations[0].color.g, 80, 120, rng),
|
random_step(self->animations[0].color.g, 20, 40, rng),
|
||||||
15);
|
random_step(self->animations[0].color.g, 20, 40, rng),
|
||||||
animation_begin(
|
random_step(self->animations[0].color.g, 80, 120, rng),
|
||||||
&self->animations[1],
|
15);
|
||||||
random_step(self->animations[0].color.g, 0, 30, rng),
|
break;
|
||||||
random_step(self->animations[0].color.g, 0, 30, rng),
|
case 1:
|
||||||
random_step(self->animations[1].color.g, 60, 100, rng),
|
animation_begin(
|
||||||
15);
|
&self->animations[1],
|
||||||
animation_begin(
|
random_step(self->animations[0].color.g, 0, 30, rng),
|
||||||
&self->animations[2],
|
random_step(self->animations[0].color.g, 0, 30, rng),
|
||||||
random_step(self->animations[0].color.g, 0, 10, rng),
|
random_step(self->animations[1].color.g, 60, 100, rng),
|
||||||
random_step(self->animations[0].color.g, 0, 10, rng),
|
30);
|
||||||
random_step(self->animations[2].color.g, 20, 40, rng),
|
break;
|
||||||
15);
|
case 2:
|
||||||
|
animation_begin(
|
||||||
|
&self->animations[2],
|
||||||
|
random_step(self->animations[0].color.g, 0, 10, rng),
|
||||||
|
random_step(self->animations[0].color.g, 0, 10, rng),
|
||||||
|
random_step(self->animations[2].color.g, 20, 40, rng),
|
||||||
|
45);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
void lantern_set_mode(lantern_t *self, color_scheme_e scheme) {
|
void lantern_set_mode(lantern_t *self, color_scheme_e scheme) {
|
||||||
self->color_scheme = scheme;
|
self->color_scheme = scheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lantern_step(lantern_t *self, display_t *display, rng_t *rng, rgb_t colors[LIGHT_COUNT]) {
|
void lantern_step(lantern_t *self, display_t *display, rng_t *rng, rgb_t colors[LIGHT_COUNT]) {
|
||||||
/*
|
|
||||||
if (!animation_running(&self->animations[0])) {
|
|
||||||
// display_lantern(display, self);
|
|
||||||
switch (self->color_scheme) {
|
|
||||||
case test:
|
|
||||||
lantern_start_test(self);
|
|
||||||
break;
|
|
||||||
case normal:
|
|
||||||
lantern_start_normal(self, rng);
|
|
||||||
break;
|
|
||||||
case spooky:
|
|
||||||
lantern_start_spooky(self, rng);
|
|
||||||
break;
|
|
||||||
case eerie:
|
|
||||||
lantern_start_eerie(self, rng);
|
|
||||||
break;
|
|
||||||
case flash:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
for (int i = 0; i < LIGHT_COUNT; i++) {
|
for (int i = 0; i < LIGHT_COUNT; i++) {
|
||||||
if (!animation_running(&self->animations[i])) {
|
if (!animation_running(&self->animations[i])) {
|
||||||
switch (self->color_scheme) {
|
switch (self->color_scheme) {
|
||||||
|
@ -227,8 +219,10 @@ void lantern_step(lantern_t *self, display_t *display, rng_t *rng, rgb_t colors[
|
||||||
lantern_start_normal(self, rng, i);
|
lantern_start_normal(self, rng, i);
|
||||||
break;
|
break;
|
||||||
case spooky:
|
case spooky:
|
||||||
|
lantern_start_spooky(self, rng, i);
|
||||||
break;
|
break;
|
||||||
case eerie:
|
case eerie:
|
||||||
|
lantern_start_eerie(self, rng, i);
|
||||||
break;
|
break;
|
||||||
case flash:
|
case flash:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue