Skip to content

3zcurdia/mandelbrot-wasm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mandelbrot-wasm

Mandelbrot tree implementation with rust to compile for webasm

Build

wasm-pack build --target web

Usage

  import init, { mandelbrot_pixels } from "./mandelbrot.js";

  await init();

  const canvas = document.getElementById("canvas");
  const width = parseInt(canvas.getAttribute("width"));
  const height = parseInt(canvas.getAttribute("height"));
  let ctx = canvas.getContext("2d");

  let pixels = Uint8ClampedArray.from(mandelbrot_pixels(width, height, 1000, -2.0, 1.0, -1.0, 1.0));
  let imageData = new ImageData(pixels, width, height);
  ctx.putImageData(imageData, 0, 0);

About

Mandelbrot tree implementation with rust to compile for webasm

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages