Polar Coordinate - Archimedean spiral

Developer
Size
2,114 Kb
Views
16,192

How do I make an polar coordinate - archimedean spiral?

What is a polar coordinate - archimedean spiral? How do you make a polar coordinate - archimedean spiral? This script and codes were developed by JasonPark on 01 January 2023, Sunday.

Polar Coordinate - Archimedean spiral Previews

Polar Coordinate - Archimedean spiral - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Polar Coordinate - Archimedean spiral</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <svg id="board" width=500 height=500>
</svg> <script src="js/index.js"></script>
</body>
</html>

Polar Coordinate - Archimedean spiral - Script Codes CSS Codes

#board { border:1px solid black;
}

Polar Coordinate - Archimedean spiral - Script Codes JS Codes

const board = document.getElementById('board');
const width = 500;
const height = 500;
function decimalToColorHexString(number){ number %= 16777216; let table = [ '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' ]; let q = number; let st = [] while( q > 0 ){ let r = q % 16; q = ~~(q / 16); st.push(r); } let residual = 6 - st.length; for(let i = 0 ; i < residual; i++){ st.push(0); } st.reverse(); return st.map((elem) => (table[elem])).reduce((x, y) => (x + y), '');
}
function drawCurve(scale, limit, dt, colorScale){ let color = 1 let colorAccel = 1 for(let theta = 0; theta < limit; theta += dt){ if (scale / dt > 10000) { return; } let y =scale*theta*Math.sin(theta); let x =scale*theta*Math.cos(theta); let c = document.createElementNS("http://www.w3.org/2000/svg", "circle"); let colorCode = '#'+ decimalToColorHexString(color); c.setAttribute('cx', x + width/2); c.setAttribute('cy', y + height/2); c.setAttribute('r' , 1); c.setAttribute('fill', colorCode); board.appendChild(c); color += colorScale*(colorAccel + 1) ; colorAccel += 1; }
}
drawCurve(12.5, 20, 0.05, 5);
Polar Coordinate - Archimedean spiral - Script Codes
Polar Coordinate - Archimedean spiral - Script Codes
Home Page Home
Developer JasonPark
Username wooljs
Uploaded January 01, 2023
Rating 3
Size 2,114 Kb
Views 16,192
Do you need developer help for Polar Coordinate - Archimedean spiral?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

JasonPark (wooljs) Script Codes
Create amazing Facebook ads with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!