Code Monkey home page Code Monkey logo

fractals-js's Introduction

AWAIT CONVERGENCE AWAIT CONVERGENCE

Space/Click for new fractal!


The mechanics behind JS-Fractals can be broken down into simple rules that are applied recursively.

In this example, we will use the circle, but other shapes (just squares for now!) follow the same rules.

First, a center or 'parent' circle of random size is drawn.

Initial Circle

Next, 4 children circles of some fractional size of the parent circle are drawn on the parent circle's curve

Children Circles

Each of those children circles draws its own children circles.

Children Circles

The children circles may or may not be drawn in the opposite direction of the previous child. This is a randomized characteristic of each fractal.

Notice how the first left child circle is missing its right child circle? Since left is opposite of right, this child was not drawn.

  • Ex. Previous child circle was drawn leftward from its parent, so the next children circles are drawn leftward, upward, and downward.
  • Ex. Previous circle was drawn downward from its parent, so the next children circles are drawn leftward, rightward, and downward.

However, this does not always hold true. This depends on the random boolean trait, which in the alternate case would draw children in all 4 directions.

Once these circles are drawn, they are all transformed in a circular fashion relative to their parent circle.

The first or center circle is stationary, as a circle rotated about its center does not move.

Its children follow the center circles' curve and orbit it. (Here, the children are rotating clockwise)

Children Circles

The children of those children are rotationally transformed twice, as they are moved relative to their parent which was moved relative to the center circle.

Children Circles

This is done recursively, and each subsequent circle moves more and more. This is what causes the chaotic look of the fractal.

  • Since sin(x) and cos(x) are used for the rotational transformations, the fractal eventually converges and creates a square-ish shape before moving back into random chaos (or at least what appears to be random chaos but mathematically isnt)

fractals-js's People

Contributors

trevin-small avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.