Skip to content

Commit 38fec3e

Browse files
author
stephen
committed
scenes can animate colours, too
1 parent 6650878 commit 38fec3e

2 files changed

Lines changed: 24 additions & 4 deletions

File tree

src/model.rs

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ impl Model {
398398
&control_macro_in_fixture.label, control_macro_in_scene
399399
);
400400
if let Some(ms) = animation_ms {
401+
debug!("Scene includes animation; animate Control Value over {}ms", ms);
401402
control_macro_in_fixture.animation =
402403
Some(Animation::new(
403404
Duration::from_millis(ms),
@@ -410,7 +411,7 @@ impl Model {
410411
Box::new(SineInOut),
411412
))
412413
} else {
413-
debug!("No Animation specified; change immediate");
414+
debug!("No Animation specified; change Control Value immediately");
414415
control_macro_in_fixture.current_value =
415416
*control_macro_in_scene;
416417
}
@@ -439,8 +440,27 @@ impl Model {
439440
&fixture.label,
440441
&colour_macro_in_fixture.label, colour_macro_in_scene
441442
);
442-
colour_macro_in_fixture.current_value =
443-
*colour_macro_in_scene;
443+
if let Some(ms) = animation_ms {
444+
debug!("Scene includes animation; animate Colour over {}ms", ms);
445+
let animation = Animation::new(
446+
Duration::from_millis(ms),
447+
0.0,
448+
1.0,
449+
Box::new(SineInOut),
450+
);
451+
let start_colour =
452+
colour_macro_in_fixture.current_value;
453+
let end_colour = *colour_macro_in_scene;
454+
colour_macro_in_fixture.animation = Some((
455+
animation,
456+
start_colour,
457+
end_colour,
458+
));
459+
} else {
460+
debug!("No Animation specified; change Colour immediately");
461+
colour_macro_in_fixture.current_value =
462+
*colour_macro_in_scene;
463+
}
444464
}
445465
}
446466
}

tether-egui-testing.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
},
148148
"midiMapping": null
149149
},
150-
"value": "{\"macroLabel\":\"colour\", \"value\": { \"ColourValue\": [255,0,0,255] } }"
150+
"value": "{\"macroLabel\":\"colour\", \"value\": { \"ColourValue\": [20,100,10,255] },\"duration\":5000 }"
151151
}
152152
}
153153
],

0 commit comments

Comments
 (0)