Skip to main content
100%

Colored Mandelbrot with P5.js

✓ Published0🌍 Public
CCurran Kelleher
Last edited Jan 31, 2024
Created on Jan 31, 2024

This example renders an interactive Mandelbrot set fractal using the p5.js library, with a custom color palette applied to the escape-time values. The visualization iterates over every pixel in the canvas, mapping coordinates to the complex plane and testing how quickly each point diverges under the z = z² + c formula. Instead of grayscale, the code assigns vibrant RGB values derived from the iteration count, producing psychedelic gradients within the fractal’s basin. It uses p5’s `loadPixels`, `updatePixels`, and `map` functions to manipulate the pixel array directly.

AI-generated description

The P5JS example: Mandelbrot Set.

Modified to make some fancy colors!

MIT Licensed

Similar vizzes