Project Two section 2 part d VARIATIONS

by Susan Delgado

HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

    <h1>Project Two section 2 part D Variations attemtps</h1>
​Provide at least four different setups that change the way that the fractal looks. Include things like the depth of recursion, colors, or a changed algorithm. Be creative!

 <br/>
 <br/>
    <script src="proj2.js"></script>

   
        <!-- STEP 3 A: (STARTUP FRACTAL CALL)
        Set your canvas dimensions to width="500" height="500"  -->
    
    <canvas id="myCanvas" width="500" height="500" style="border:1px solid #000000;"></canvas>

JavaScript

/* ======================================================================
STEP 5: variations
==================================================================== */

/* ==========================================================
VARIATION #1: DEPTH OF RECURSION
Teacher suggested:
- Change recursion depth

Original: const maxLevels = 4
Variation: const maxLevels = 7
========================================================== */

// recursion depth
const maxLevels = 5;


/* =========================
STARTUP CODE
========================= */

$(document).ready(function() {

    var c = document.getElementById("myCanvas");
    var context = c.getContext("2d");

    let startX = c.width / 2;
    let startY = c.height / 2;

    let startLength = 100;
    let startLevel = 0;

    /* =========================
       DRAW CALLS
    ========================= */

    // original calls (tree form)
    // drawBranch(startX, startY, 0,   startLength, startLevel, context);
    // drawBranch(startX, startY, 90,  startLength, startLevel, context);
    // drawBranch(startX, startY, -90, startLength, startLevel, context);
    // drawBranch(startX, startY, 180, startLength, startLevel, context);

    /* =========================
       QUILT STAR (radial setup)
    ========================= */

    /*
    for (let i = 0; i < 12; i++) {
        let angle = i * 30;

        drawBranch(
            startX,
            startY,
            angle,
            startLength,
            startLevel,
            context
        );
    }
    */

    /* =========================
       FLOWER SETUP
    ========================= */

    /*
    for (let i = 0; i < 8; i++) {
        let angle = i * 45;

        drawFlowerBranch(
            startX,
            startY,
            angle,
            startLength,
            startLevel,
            context
        );
    }
    */

    /* =========================
      ...