jfractal
v1.0.0
Published
Small javascript library to generate fractals in HTML5 canvas
Downloads
2
Readme
jFractal
A small javascript library to generate 2D fractals using HTML5 canvas and a lot of dependency injection.
Dependencies
It depends on the jPalette library.
How to install
Node.js
npm install --save jpalette jfractal
Download
Just download repositories jPalette and jFractal.
How to import
ES6 import
import * as jPalette from 'jpalette';
import * as jFractal from 'jfractal';
HTML script tag
<script src="jpalette.min.js"></script>
<script src="jfractal.min.js"></script>
How to use
Basic example
<canvas id="fractal" width="400" height="300"></canvas>
let display = new jFractal.StandardDisplay(
new jFractal.Picture(
document.getElementById('fractal'),
{left:-2.5, right:0.5, bottom:-1.5, top:1.5, keepRatio: true}
),
new jFractal.SmoothBailoutColoring(
new jFractal.BailoutAlgo(new jFractal.MandelbrotEquation(), 40, 1 << 16),
jPalette.Color.get('black')(255),
jPalette.ColorMap.get('night')(2000)
)
).refresh();
Basic parameters available
Display
- SimpleDisplay
- ProgressiveDisplay
- ThreadedDisplay (worker.min.js must be in the same directory as your index.html)
Algorithm
- BailoutAlgo
- NewtonAlgo
Equations
- MandelbrotEquation
- TricornEquation
- BurningShipEquation
- NewtonEquation
Coloring
- SimpleColoring
- BailoutColoring
- SmoothBailoutColoring
- AngleColoring
- BinaryColoring