Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberZenDev authored Nov 1, 2024
1 parent 7dc0fdb commit b21b850
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions complex-pentagon/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
@title: Complex Pentagons
@author: CyberZenDev
@snapshot: snap1.png
*/

const width = 125;
const height = 125;

setDocDimensions(width, height);

const finalLines = [];

// Define the base pentagon vertices centered at (0, 0)
const basePentagon = [
[0, -50],
[43.30, -25],
[26.98, 25],
[-26.98, 25],
[-43.30, -25],
[0, -50]
];

// Loop for 100 nested pentagons
for (let i = 0; i < 130; i++) {
const innerPentagon = JSON.parse(JSON.stringify(basePentagon));

const scaleFactor = 1 - (bt.randIntInRange(0, 5) / 100);
bt.scale([innerPentagon], scaleFactor);
bt.rotate([innerPentagon], (i * 3.6) + bt.randIntInRange(0, 30));
bt.translate([innerPentagon], [63.1, 75.6]);

finalLines.push(innerPentagon);
}

const sunRadius = 15;
const sunCenter = [62.5, 62.5];

const sunCircle = [];
for (let angle = 0; angle < 360; angle += 10) {
const radians = (angle * Math.PI) / 180;
sunCircle.push([sunCenter[0] + sunRadius * Math.cos(radians), sunCenter[1] + sunRadius * Math.sin(radians)]);
}
sunCircle.push(sunCircle[0]);

finalLines.push(sunCircle);

drawLines(finalLines);
Binary file added complex-pentagon/snapshots/snap1.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 b21b850

Please sign in to comment.