Проектная работа - WIP
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user