Project Two section 2 part b

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 B</h1>

With one branch, it should look like this:<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>
     If that works you can add more branches. Set your canvas dimensions to width="500" height="500" and begin with the angle set to 0 and the starting positions for x and y as<br>

x = canvas.width / 2;<br>

y = canvas.height / 2;<br>

JavaScript

/* ======================================================================
    SETUP COPY TEACHERS CODE IN JSFIBBLE Project 2
    STEP 1 : follow steps jsFiddle Project Two section 2 part a
    STEP 2 : follow steps in jsFiddle Project Two section 2 part a
    STEP 3 : 4 Branches in jsFiddle Project Two section 2 part B
    STEP 4 : Seven Branchesin jsFiddle Project Two section 2 part c
    STEP 5: variations in new fiddle(s)
==================================================================== */
/* ======================================================================
    STEP 3 : 
    In this project, your job is to create the code for the drawBranch() function. Test it by drawing one branch of the tree, setting maxLevels to 4. If that works you can add more branches. Set your canvas dimensions to width="500" height="500" and begin with the angle set to 0 and the starting positions for x and y as

    x = canvas.width / 2;
    y = canvas.height / 2;
==================================================================== */

    /* ======================================================================
    STEP 4 : go to next
==================================================================== */

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

$(document).ready(function() {

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

/* ================================================
        STEP 3: drawing one branch of the tree, setting maxLevels to 4(STARTUP FRACTAL CALL)
        start position = center of canvas
   ================================================  */

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

    let startAngle = 0;
    let startLength = 100;
    let startLevel = 0;

    drawBranch(
        startX,
        startY,
        startAngle,
        startLength,
        startLevel,
        context
    );

});
/*...