1.0.0 • Published 5 years ago

jfractal v1.0.0

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

jFractal

A small javascript library to generate 2D fractals using HTML5 canvas and a lot of dependency injection.

Full demo application

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();

Demo

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

Examples

Mandelbrot set

Burning ship set

Newton set

Julia set

Julia set

Mandelbrot set

Julia set

Newton set