Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
ansh3108 authored Jul 20, 2024
1 parent 7d6fc6d commit 830196b
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions art/harmonograph-Ansh/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
const width = 125;
const height = 125;

setDocDimensions(width, height);

const t = new bt.Turtle();

const e= 2.71828

const polylines= t.lines();

const scale = 30
const p1 = 1;
const f1 = 1;
const d1 = 0;

const p2 = 1;
const f2 = 1;
const d2 = 0;

const p3 = 1;
const f3 = 1;
const d3 = 0;

const p4 = 1;
const f4 = 1;
const d4 = 0;

function walk(step) {
const i = step / 100;
const x = Math.sin(f1 * i + p1) * Math.pow(e, -d1 * i) + Math.sin(f2 * i + p2) * Math.pow(e, -d2 * i);
const y = Math.sin(f3 * i + p3) * Math.pow(e, -d3 * i) + Math.sin(f4 * i + p4) * Math.pow(e, -d4 * i);
t.goTo([scale * x, scale * y]);
t.down();
return step < 10000;
}


let step = 0;
while (walk(step)) {
step++;
}
function centerPolylines(polylines, documentWidth, documentHeight) {
const cc = bt.bounds(polylines).cc;
bt.translate(polylines, [documentWidth / 2, documentHeight / 2], cc);
}

let final = t.lines()
centerPolylines(final,width,height)

drawLines(final);
Binary file added art/harmonograph-Ansh/snapshots/snapshot1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/harmonograph-Ansh/snapshots/snapshot2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/harmonograph-Ansh/snapshots/snapshot3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 830196b

Please sign in to comment.