Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
scarlettekk authored Nov 20, 2024
1 parent 3c6358a commit e23a6d9
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions art/jitter-scarlettekk/jitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,42 @@


/* VARIABLES */
const spiralTightness = 0.00025;
const spiralSize = 1;
const jitterIterationDampener = 0.0001;
const jitterLengthDampener = 0.0005;
const jitterMaxAngle = 360;
var spiralTightness = bt.randInRange(0.5, 1);
var spiralSize = bt.randInRange(0.5, 1);
var jitterIterationDampener = bt.randInRange(0.1, 1);
var jitterLengthDampener = bt.randInRange(0.1, 1);
var jitterMaxAngle = bt.randInRange(180, 360);

/* allow normalization of variables to 1 */
spiralTightness *= 0.00025;
jitterIterationDampener *= 0.0001;
jitterLengthDampener *= 0.0005;

setDocDimensions(125, 125); // center is 63, 63
const bounds = [[[0, 0], [0, 125], [125, 125], [125, 0], [0, 0]]];
const t = new bt.Turtle();
const tt = new bt.Turtle(); //used for tracking the pure spiral

const tt = new bt.Turtle(); //used for introducing wobble
const ttt = new bt.Turtle(); //used for tracking the pure spiral
t.jump([63,63]);
tt.jump([63,63]);
ttt.jump([63,63]);
ttt.up();
tt.up();
t.down();

for (var i = 0; i <= 4000; i++) {
tt.forward(i * spiralTightness); // track the
tt.right(spiralSize); // pure spiral
ttt.forward(i * spiralTightness); // track the
ttt.right(spiralSize); // pure spiral
tt.right(bt.randInRange(0, 30));
tt.forward(5);
for (var z = 0; z < bt.randIntInRange(0, 50) * i * jitterIterationDampener; z++) {
t.right(bt.randInRange(0, jitterMaxAngle)); // introduce the jitter to the
t.forward(bt.rand() * i * jitterLengthDampener); // drawing turtle
}
t.goTo(tt.pos); // reset jitter for the next step
tt.goTo(ttt.pos);
}

drawLines(t.lines());
drawLines(bt.cut(t.lines(), bounds));
drawLines(bt.text("the downward spiral", [3,10], 0.5));
drawLines(bt.text("coraline shuryn", [3,5], 0.5));
drawLines(bt.text("coraline shuryn", [3,5], 0.5));

0 comments on commit e23a6d9

Please sign in to comment.