gl-react-julia
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

gl-react-julia

Universal gl-react Julia set fractals.

Julia sets are generated by iterating z = z^p + c for each point z in the complex plane.

This package includes a standard Julia set (<JuliaFractal>)), along with two extensions of the concept:

  • <JuliaImageFractal>: picks up paint from a source image at each successive z and combines it as the color of pixel z0
  • <JuliaFieldFractal>: like JuliaImageFractal, but p is recomputed each iteration as a function of the underlying image color and any other numbers that are handy (e.g. z, c, z0, etc.)

Props

  • center (required): [x, y]
  • zoom (required): 0 is full size, 1 is double magnification, 2 is 4x, ...
  • c (required): Julia constant -- [real, imaginary]
  • p (required): Julia power (number) (or input to JuliaFieldFractal's fieldExpr)
  • image: source url for JuliaImageFractal and JuliaFieldFractal
  • fieldExpr: e.g. dot(hsv.xz, z) -- Julia power p varies with the angle between (hue, brightness) and (real, imaginary) vectors. The output is interpreted as a proportion of r vs q: p = q + (r-q)*$fieldExpr.
  • q (JuliaFieldFractal only) -- input to fieldExpr
  • r (JuliaFieldFractal only) -- input to fieldExpr

npm

  • npm install --save gl-react-julia gl-react gl-react-dom
  • npm install --save-dev @types/gl-react @types/gl-react-dom buffer

Example

import { Surface } from "gl-react-dom"; // for React DOM
import { JuliaImageFractal } from 'gl-react-julia';

const imageUrl = 'https://upload.wikimedia.org/wikipedia/commons/8/8c/%22Alexander_Visits_the_Sage_Plato_in_his_Mountain_Cave%22%2C_Folio_from_a_Khamsa_%28Quintet%29_of_Amir_Khusrau_Dihlavi_MET_h1_13.228.30.jpg';

function App() {
  return <Surface width={900} height={600}>
      <JuliaImageFractal
        center={[-.5, 0]}
        zoom={2.1}
        c={[.65, -.35]}
        p={3}
        image={imageUrl} 
      />
    </Surface>;
}

Package Sidebar

Install

npm i gl-react-julia

Weekly Downloads

0

Version

1.0.4

License

MIT

Unpacked Size

24 kB

Total Files

11

Last publish

Collaborators

  • nicolaitanes