examples
src
geometry
graphics
random
video
···
194
194
let object_name = format!("{}", ctx.ms);
195
195
layer.set_object(
196
196
&object_name,
197
197
-
Object::Dot(world.resized(-1, -1).random_point(&mut ctx.extra.rng))
198
198
-
.colored(Color::Cyan),
197
197
+
Object::Dot(
198
198
+
world.resized(-1, -1).random_point(&mut ctx.extra.rng),
199
199
+
)
200
200
+
.colored(Color::Cyan),
199
201
);
200
202
201
203
canvas.put_layer_on_top("ch");
···
1
1
use crate::{Object, Point};
2
2
-
use anyhow::{Error, Result, format_err};
2
2
+
use anyhow::{format_err, Error, Result};
3
3
use backtrace::Backtrace;
4
4
#[cfg(feature = "web")]
5
5
use wasm_bindgen::prelude::*;
···
181
181
}
182
182
183
183
pub fn max<'a>(&'a self, other: &'a Region) -> &'a Region {
184
184
-
if self.within(other) { other } else { self }
184
184
+
if self.within(other) {
185
185
+
other
186
186
+
} else {
187
187
+
self
188
188
+
}
185
189
}
186
190
187
191
pub fn merge<'a>(&'a self, other: &'a Region) -> Region {
···
6
6
use measure_time::debug_time;
7
7
8
8
use crate::{
9
9
+
fonts::{load_fonts, FontOptions},
9
10
Color, ColorMapping, Fill, Filter, Layer, Object, ObjectSizes, Point, Region,
10
10
-
fonts::{FontOptions, load_fonts},
11
11
};
12
12
13
13
use super::ColoredObject;
···
2
2
#[cfg(feature = "web")]
3
3
use wasm_bindgen::prelude::*;
4
4
5
5
-
use super::{Color, fill::FillOperations};
5
5
+
use super::{fill::FillOperations, Color};
6
6
7
7
#[derive(Debug, Clone, PartialEq, Eq)]
8
8
pub enum LineSegment {
···
1
1
use rand::{
2
2
-
Rng,
3
2
distr::{Distribution, StandardUniform, Uniform},
3
3
+
Rng,
4
4
};
5
5
6
6
use crate::Angle;
···
1
1
use crate::{Canvas, ColoredObject, Fill, Layer, Object, Region};
2
2
-
use rand::{Rng, distr::uniform::SampleRange};
2
2
+
use rand::{distr::uniform::SampleRange, Rng};
3
3
use std::collections::HashMap;
4
4
5
5
impl Canvas {
···
7
7
self.random_layer_within(rng, name, &self.world_region.clone())
8
8
}
9
9
10
10
-
pub fn random_object(&mut self, rng: &mut impl Rng,) -> Object {
10
10
+
pub fn random_object(&mut self, rng: &mut impl Rng) -> Object {
11
11
self.random_object_within(rng, &self.world_region.clone())
12
12
}
13
13
···
107
107
self.add_layer(layer)
108
108
}
109
109
110
110
-
pub fn random_linelikes( &mut self, rng: &mut impl Rng, layer_name: &str) -> &mut Layer {
110
110
+
pub fn random_linelikes(
111
111
+
&mut self,
112
112
+
rng: &mut impl Rng,
113
113
+
layer_name: &str,
114
114
+
) -> &mut Layer {
111
115
self.random_curves_within(
112
116
rng,
113
117
layer_name,
···
116
120
)
117
121
}
118
122
119
119
-
pub fn random_region( &mut self, rng: &mut impl Rng) -> Region {
123
123
+
pub fn random_region(&mut self, rng: &mut impl Rng) -> Region {
120
124
Region::random(rng, &self.world_region.clone())
121
125
}
122
126
}
···
1
1
use crate::Color;
2
2
use rand::{
3
3
-
Rng,
4
3
distr::{Distribution, StandardUniform},
4
4
+
Rng,
5
5
};
6
6
7
7
impl Distribution<Color> for StandardUniform {
···
1
1
-
use super::Animation;
2
1
use super::animation::{AnimationUpdateFunction, LayerAnimationUpdateFunction};
3
2
use super::engine::{LaterHook, LaterRenderFunction};
3
3
+
use super::Animation;
4
4
use crate::synchronization::audio::StemAtInstant;
5
5
use crate::synchronization::sync::SyncData;
6
6
use itertools::Itertools;