lightshow/lightshow.rs
1/// Make a lightshow in webmapper!
2///
3/// This example demonstrates how to create a device and set a custom property on it.
4
5use std::time::Duration;
6
7use libmapper_rs::{device::Device, object::MapperObject};
8
9fn main() {
10 let dev = Device::create("discoball");
11 loop {
12 dev.poll_and_block(Duration::from_millis(10));
13 if dev.is_ready() {
14 break;
15 }
16 }
17
18 println!("Device became ready!");
19 let mut hue = 0;
20 loop {
21 dev.poll_and_block(Duration::from_millis(5));
22 dev.set_custom_property("color.hue", hue as f64 / 360.0, true);
23 hue = (hue + 1) % 360;
24 }
25}