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

Add Matthew's mandelbrot piece to title slide, and center everything.

parent 6769e043
No related branches found
No related tags found
No related merge requests found
src/image/mandelbrot.png

32.1 KiB

......@@ -4,6 +4,8 @@ use crate::fade_in::fade_in;
use crate::slide::Slide;
use crate::{ctx_img, Margin};
use eframe::egui::{Frame, TextureHandle, Ui, Vec2, Window};
use eframe::emath::Pos2;
use crate::window::WindowPosition;
/// The first slide in the cartoon.
#[derive(Default)]
......@@ -37,29 +39,35 @@ impl Slide for Title {
fn show(&mut self, ui: &mut Ui) {
if self.examples.is_empty() {
// For now, these images are somewhat like placeholders.
self.examples = vec![
ctx_img!(ui.ctx(), "abstract0.png"),
ctx_img!(ui.ctx(), "atom0.png"),
ctx_img!(ui.ctx(), "mud0_1.png"),
ctx_img!(ui.ctx(), "fluid0.png"),
ctx_img!(ui.ctx(), "raymarching1.png"),
ctx_img!(ui.ctx(), "atom2.png"),
ctx_img!(ui.ctx(), "raymarching0.png"),
ctx_img!(ui.ctx(), "raytracing0.png"),
ctx_img!(ui.ctx(), "rock0_1.png"),
ctx_img!(ui.ctx(), "atom1.png"),
ctx_img!(ui.ctx(), "abstract1.png"),
ctx_img!(ui.ctx(), "slime1.png"),
ctx_img!(ui.ctx(), "raymarching0.png"),
ctx_img!(ui.ctx(), "fluid0.png"),
ctx_img!(ui.ctx(), "slime0.png"),
ctx_img!(ui.ctx(), "line0.png"),
ctx_img!(ui.ctx(), "rock0_1.png"),
ctx_img!(ui.ctx(), "abstract1.png"),
ctx_img!(ui.ctx(), "slime1.png"),
ctx_img!(ui.ctx(), "atom2.png"),
ctx_img!(ui.ctx(), "raymarching1.png"),
ctx_img!(ui.ctx(), "mandelbrot.png"),
ctx_img!(ui.ctx(), "line1.png"),
];
}
for example in &self.examples {
const COLUMNS: usize = 5;
const ROWS: usize = 3;
let available = ui.available_size();
for (i, example) in self.examples.iter().enumerate() {
let row = i / COLUMNS;
let column = i % COLUMNS;
let position = Pos2::new(column as f32 * available.y / ROWS as f32, row as f32 * available.y / ROWS as f32) + Vec2::new(62.0,16.0);
Image::default()
.height(ui.available_height() * 0.295)
.height(available.y * 0.295)
.position(WindowPosition::Global(position))
.show(ui, example);
}
......
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