Проектная работа - WIP

This commit is contained in:
13 changed files with 149 additions and 225 deletions
+3 -13
View File
@@ -99,11 +99,7 @@ fn draw(
) {
if *i == 0 {
// Generate a random color on first run.
*draw_color = Color::linear_rgb(
seeded_rng.0.random(),
seeded_rng.0.random(),
seeded_rng.0.random(),
);
*draw_color = Color::linear_rgb(seeded_rng.0.random(), seeded_rng.0.random(), seeded_rng.0.random());
}
// Get the image from Bevy's asset storage.
@@ -126,17 +122,11 @@ fn draw(
// If the old color is our current color, change our drawing color.
let tolerance = 1.0 / 255.0;
if old_color.distance(&draw_color) <= tolerance {
*draw_color = Color::linear_rgb(
seeded_rng.0.random(),
seeded_rng.0.random(),
seeded_rng.0.random(),
);
*draw_color = Color::linear_rgb(seeded_rng.0.random(), seeded_rng.0.random(), seeded_rng.0.random());
}
// Set the new color, but keep old alpha value from image.
image
.set_color_at(x, y, draw_color.with_alpha(old_color.alpha()))
.unwrap();
image.set_color_at(x, y, draw_color.with_alpha(old_color.alpha())).unwrap();
*i += 1;
}