Skip to content
Snippets Groups Projects
Commit 2480cacc authored by Finn Bear's avatar Finn Bear
Browse files

Revisions to fractal and conclusion slides.

parent 584fc9aa
No related branches found
No related tags found
No related merge requests found
...@@ -71,7 +71,7 @@ impl Slide for Conclusion { ...@@ -71,7 +71,7 @@ impl Slide for Conclusion {
name: "slides", name: "slides",
position: WindowPosition::FromCenter(Vec2::new(0.0, ui.available_height() * 0.08)), position: WindowPosition::FromCenter(Vec2::new(0.0, ui.available_height() * 0.08)),
size: Vec2::new(ui.available_width() * 0.95, ui.available_height() * 0.85), size: Vec2::new(ui.available_width() * 0.95, ui.available_height() * 0.85),
scroll: Some((elapsed * 64.0).min(1065.0)), scroll: Some((elapsed * 90.0 + 350.0).min(1065.0)),
background: Color32::TRANSPARENT, background: Color32::TRANSPARENT,
alpha: get_style_alpha(ui.style()), alpha: get_style_alpha(ui.style()),
code: String::from(include_str!("../cartoon.rs")), code: String::from(include_str!("../cartoon.rs")),
......
...@@ -251,7 +251,12 @@ impl Slide for Automata { ...@@ -251,7 +251,12 @@ impl Slide for Automata {
/// Run one iteration of Conway's Game of Life on the grid, producing a new grid. /// Run one iteration of Conway's Game of Life on the grid, producing a new grid.
/// ///
/// A non-zero expansion parameter expands the grid on each side by that many squares. /// A non-zero expansion parameter expands the grid on each side by that many squares.
fn conways_game_of_life(grid: &Grid, expansion: usize, alive_color: Color32, fade: bool) -> Grid { pub fn conways_game_of_life(
grid: &Grid,
expansion: usize,
alive_color: Color32,
fade: bool,
) -> Grid {
let mut new = grid.clone(); let mut new = grid.clone();
new.clear_fill(); new.clear_fill();
......
...@@ -12,7 +12,7 @@ use crate::egui; ...@@ -12,7 +12,7 @@ use crate::egui;
use crate::egui::{Color32, Context, Frame, Pos2, Shape, Stroke, Ui}; use crate::egui::{Color32, Context, Frame, Pos2, Shape, Stroke, Ui};
use crate::fade_in::{fade_in, fade_in_manual, fade_out, fade_out_manual}; use crate::fade_in::{fade_in, fade_in_manual, fade_out, fade_out_manual};
use crate::governor::Governor; use crate::governor::Governor;
use crate::slide::s4_automata::randomize_grid; use crate::slide::s4_automata::{conways_game_of_life, randomize_grid};
use crate::slide::s6_fractals::circle::circle; use crate::slide::s6_fractals::circle::circle;
use crate::slide::s6_fractals::dummy::is_black; use crate::slide::s6_fractals::dummy::is_black;
use crate::slide::s6_fractals::mandelbrot::mandelbrot; use crate::slide::s6_fractals::mandelbrot::mandelbrot;
...@@ -109,6 +109,11 @@ impl Default for Fractals { ...@@ -109,6 +109,11 @@ impl Default for Fractals {
randomize_grid(&mut grid); randomize_grid(&mut grid);
// Make grid more life-like.
for _ in 0..10 {
grid = conways_game_of_life(&grid, 0, Color32::BLACK, false);
}
// Grid cell stroke aliases too much at this resolution. // Grid cell stroke aliases too much at this resolution.
grid.stroke_width = 0.0; grid.stroke_width = 0.0;
...@@ -271,7 +276,7 @@ impl Slide for Fractals { ...@@ -271,7 +276,7 @@ impl Slide for Fractals {
// Fade out the automata cells. // Fade out the automata cells.
for (_, _, cell) in self.grid.iter_mut() { for (_, _, cell) in self.grid.iter_mut() {
if cell.a() > 0 { if cell.a() > 0 {
*cell = set_alpha(Color32::BLACK, alpha); *cell = set_alpha(*cell, alpha);
} }
} }
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment