diff --git a/src/main.rs b/src/main.rs index 32fb56a..3fd96eb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,10 @@ use image::{ImageBuffer, Rgb}; use rayon::prelude::*; -// Image size. +// Number of frames to generate. +const FRAMES = 200; + +// Frame size. const IMGW: u32 = 1024; const IMGH: u32 = 1024; @@ -10,6 +13,10 @@ const MAXITER: u32 = IMGW; const MAXITER_F64: f64 = MAXITER as f64; const ESCRAD: f64 = 2.4; +// Target coordinates (what to "zoom in on" with each new frame.) +const TARGX = -0.4638686756; +const TARGX = 0.0723647; + fn main() { let w = IMGW as f64; let h = IMGH as f64; @@ -19,12 +26,9 @@ fn main() { let mut xmin: f64 = -1.0; let mut ymin: f64 = -1.0; - let target_x = -0.4638686756; - let target_y = 0.0723647; - let zoom_factor = 1.2; - for i in 1..200 { + for i in 1..FRAMES { let pxs: Vec = (0..IMGH) .into_par_iter() .flat_map(|y| { @@ -50,8 +54,8 @@ fn main() { println!("#{i} done."); // Adjust bounds for the next zoom level - xmin = target_x - width / 2.0; - ymin = target_y - width / 2.0; + xmin = TARGX - width / 2.0; + ymin = TARGY - width / 2.0; width /= zoom_factor; // Zoom in by reducing width } } @@ -79,6 +83,7 @@ fn col_map(iter: u32) -> [u8; 3] { if iter == MAXITER { [0, 0, 0] // Black for points that never escape. } else { + // TODO: Fancy colors. let t = iter as f64 / MAXITER_F64; let c = (t * MAXITER_F64) as u8; [c, c, c]