https://github.com/hunar4321/mandelbrot
Simple Mandelbrot
https://github.com/hunar4321/mandelbrot
fractals generative-art javascript mandelbrot python
Last synced: 3 months ago
JSON representation
Simple Mandelbrot
- Host: GitHub
- URL: https://github.com/hunar4321/mandelbrot
- Owner: hunar4321
- Created: 2022-07-19T16:34:32.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-06-17T12:04:31.000Z (about 2 years ago)
- Last Synced: 2025-08-19T07:45:32.639Z (10 months ago)
- Topics: fractals, generative-art, javascript, mandelbrot, python
- Language: Python
- Homepage:
- Size: 190 KB
- Stars: 62
- Watchers: 2
- Forks: 11
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple Mandelbrot
This is the bare minimal code necessary to produce Mandelbrot set from scratch without using external libraries or complex numbers (written in both JavaScript and Python).
The following educational video provides the code walkthrough and illustrates it is relevance to Wolfram's Physics Project: https://youtu.be/mzizK6ms-gY
```html
m = document.getElementById("gardun").getContext("2d")
atom = function(x,y,c){m.fillStyle=c; m.fillRect(x,y,3,3)}
for(y=1; y<1000; y++){
for(x=1; x<1000; x++){
dx = (x-500)/2000-0.12
dy = (y-500)/2000-0.82
a = dx
b = dy
for(t=1; t<200; t++){
d = (a*a)-(b*b)+dx
b = 2*(a*b)+dy
a = d
H = d>200
if(H){ atom(x,y,"rgb("+ t*3 +","+ t +","+ t*0.5 +")"); break }
}}}
```
