Archimedean Spiral
How do I make an archimedean spiral?
What is a archimedean spiral? How do you make a archimedean spiral? This script and codes were developed by Godje on 12 September 2022, Monday.
Archimedean Spiral - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Archimedean Spiral</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <canvas id=c2></canvas>
<canvas id=c></canvas> <script src='https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.6.1/dat.gui.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/stats.js/r16/Stats.min.js'></script>
<script src='js/abbjza.js'></script> <script src="js/index.js"></script>
</body>
</html>
Archimedean Spiral - Script Codes CSS Codes
canvas { position: absolute; top: 0; left: 0;
}
body { background-color: #222; overflow: hidden;
}
Archimedean Spiral - Script Codes JS Codes
(function(){ var $ = c.getContext("2d"), $2 = c2.getContext("2d"), gui = new dat.GUI(), stats = new Stats(), w = c.width = c2.width = window.innerWidth, h = c.height = c2.height = window.innerHeight, pi = Math.PI, pi2 = pi*2, centerDistance = new Vector2(0,0).distanceTo({x:w/2, y:h/2}), opts = { bgc: "rgba(32,32,32,0.1)", showFPS: true, size: 3, a: .1, b: .3, sides: 5, c: 50, maxRad: Math.max(w,h), populate: function(){ points = []; var amount = opts.sides, step = 360/amount; for(var i = 360; i>0; i-=step){ points.push( new Point(0,0,i*pi/180) ) } }, drawBg: drawBg }, Point = function(X, Y, deg){ this.pos = new Vector2(X, Y); this.deg = deg; this.theta = 0; this.colorDeg = deg; }, points = []; Point.prototype = { update: function(){ var d = this.pos.distanceTo({x:w/2,y:h/2}), a = d/(Math.min(w/2, h/2)), step = pi2/360/a/3; this.theta+=step; this.colorDeg+=step; var thdeg = this.theta+this.deg, r = opts.a+Math.pow(opts.b*this.theta, 3), x = r*Math.cos(thdeg)*opts.c + w/2, y = r*Math.sin(thdeg)*opts.c + h/2; this.pos.set(x,y); this.pos.distanceTo({x:w/2, y:h/2}) > centerDistance*1.35 ? this.theta = 0 : void 0; return this; }, render: function(){ $.beginPath(); $.arc(this.pos.x, this.pos.y, opts.size, 0,pi2); $.closePath(); $.fillStyle = "white" $.fill(); return this; } } function setup(){ document.body.appendChild(stats.domElement); gui.close(); gui.addColor(opts, "bgc"); gui.add(opts, "showFPS"); opts.populate(); gui.add(opts, "a", 0, 1).onFinishChange(opts.populate); gui.add(opts, "b", 0, 1).onFinishChange(opts.populate); gui.add(opts, "c", 10, 1000).onFinishChange(opts.populate); gui.add(opts, "sides", 1, 100, 1).onFinishChange(opts.populate).name("Spirals"); gui.add(opts, "size", 0, 10).name("Dot Size"); gui.add(opts, "drawBg") drawBg(); requestAnimationFrame(loop); } function loop(){ stats.begin(); $.clearRect(0,0,w,h) points.map(function(P){ P.update().render(); }); for(var i=0; i < points.length; i++){ var point = points[i], point2 = points[i+1]?points[i+1]:points[0]; $2.beginPath(); $2.moveTo(point.pos.x, point.pos.y); $2.lineTo(point2.pos.x, point2.pos.y); $2.closePath(); $2.strokeStyle = "hsl("+point.colorDeg*180/pi+",50%,50%)"; $2.lineWidth = .8; $2.stroke(); } opts.showFPS ? stats.domElement.style.display = "inline-block" : stats.domElement.style.display = "none" requestAnimationFrame(loop); stats.end(); } function drawBg(){ $2.fillStyle = opts.bgc.replace("0.1", 1); $2.fillRect(0,0,w,h) } function resize(){ w = c.width = c2.width = window.innerWidth; h = c.height = c2.height = window.innerHeight; centerDistance = new Vector2(0,0).distanceTo({x:w/2, y:h/2}), drawBg(); opts.populate(); } window.addEventListener("resize", resize); setup();
})()
Developer | Godje |
Username | Godje |
Uploaded | September 12, 2022 |
Rating | 4 |
Size | 3,688 Kb |
Views | 22,264 |
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!
Name | Size |
Shoal of Pursuers | 4,099 Kb |
Just SMILE | 3,098 Kb |
Polar Roses | 3,924 Kb |
Fancy Background shapes | 2,920 Kb |
Wavy thing | 3,246 Kb |
Polygon Cursor Canvas | 3,449 Kb |
FIRE | 3,636 Kb |
Color Chaos | 4,129 Kb |
Dark Spirit Fire | 3,792 Kb |
Almost MKBHD animation | 2,802 Kb |
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!
Name | Username | Size |
Pericles mi loro... | Judag | 4,125 Kb |
A Pen by Kevin | Kevinkenger | 2,642 Kb |
CSS-Flexbox-Demo | Sstiglets | 1,709 Kb |
A simple log in form made with css | Mayurelbhar | 2,160 Kb |
Pomodoro Clock | Osycon | 3,705 Kb |
Experiments with Vertical Centering | KatieK2 | 3,924 Kb |
Fullscreen audio play button | 72 | 2,148 Kb |
SlideDown FixedMenu | Mp_graphic | 5,602 Kb |
CSS- UI Element States Pseudo-Classes | Tesla809 | 2,206 Kb |
Resize image | Happyhj | 1,892 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!