Better comments.
This commit is contained in:
parent
7729b2234b
commit
74e2d6190a
19
src/main.rs
19
src/main.rs
@ -1,7 +1,10 @@
|
|||||||
use image::{ImageBuffer, Rgb};
|
use image::{ImageBuffer, Rgb};
|
||||||
use rayon::prelude::*;
|
use rayon::prelude::*;
|
||||||
|
|
||||||
// Image size.
|
// Number of frames to generate.
|
||||||
|
const FRAMES = 200;
|
||||||
|
|
||||||
|
// Frame size.
|
||||||
const IMGW: u32 = 1024;
|
const IMGW: u32 = 1024;
|
||||||
const IMGH: u32 = 1024;
|
const IMGH: u32 = 1024;
|
||||||
|
|
||||||
@ -10,6 +13,10 @@ const MAXITER: u32 = IMGW;
|
|||||||
const MAXITER_F64: f64 = MAXITER as f64;
|
const MAXITER_F64: f64 = MAXITER as f64;
|
||||||
const ESCRAD: f64 = 2.4;
|
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() {
|
fn main() {
|
||||||
let w = IMGW as f64;
|
let w = IMGW as f64;
|
||||||
let h = IMGH as f64;
|
let h = IMGH as f64;
|
||||||
@ -19,12 +26,9 @@ fn main() {
|
|||||||
let mut xmin: f64 = -1.0;
|
let mut xmin: f64 = -1.0;
|
||||||
let mut ymin: f64 = -1.0;
|
let mut ymin: f64 = -1.0;
|
||||||
|
|
||||||
let target_x = -0.4638686756;
|
|
||||||
let target_y = 0.0723647;
|
|
||||||
|
|
||||||
let zoom_factor = 1.2;
|
let zoom_factor = 1.2;
|
||||||
|
|
||||||
for i in 1..200 {
|
for i in 1..FRAMES {
|
||||||
let pxs: Vec<u8> = (0..IMGH)
|
let pxs: Vec<u8> = (0..IMGH)
|
||||||
.into_par_iter()
|
.into_par_iter()
|
||||||
.flat_map(|y| {
|
.flat_map(|y| {
|
||||||
@ -50,8 +54,8 @@ fn main() {
|
|||||||
println!("#{i} done.");
|
println!("#{i} done.");
|
||||||
|
|
||||||
// Adjust bounds for the next zoom level
|
// Adjust bounds for the next zoom level
|
||||||
xmin = target_x - width / 2.0;
|
xmin = TARGX - width / 2.0;
|
||||||
ymin = target_y - width / 2.0;
|
ymin = TARGY - width / 2.0;
|
||||||
width /= zoom_factor; // Zoom in by reducing width
|
width /= zoom_factor; // Zoom in by reducing width
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -79,6 +83,7 @@ fn col_map(iter: u32) -> [u8; 3] {
|
|||||||
if iter == MAXITER {
|
if iter == MAXITER {
|
||||||
[0, 0, 0] // Black for points that never escape.
|
[0, 0, 0] // Black for points that never escape.
|
||||||
} else {
|
} else {
|
||||||
|
// TODO: Fancy colors.
|
||||||
let t = iter as f64 / MAXITER_F64;
|
let t = iter as f64 / MAXITER_F64;
|
||||||
let c = (t * MAXITER_F64) as u8;
|
let c = (t * MAXITER_F64) as u8;
|
||||||
[c, c, c]
|
[c, c, c]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user