<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
);
}
*/
/* =========================
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.