Curved fractal
How do I make an curved fractal?
What is a curved fractal? How do you make a curved fractal? This script and codes were developed by Findoff on 03 October 2022, Monday.
Curved fractal - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>curved fractal</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <script src='https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.5.1/dat.gui.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Curved fractal - Script Codes JS Codes
document.addEventListener('DOMContentLoaded', function(){ /* i love DOM */ var canvas = document.createElement('canvas'); document.body.appendChild(canvas); document.body.style.padding = '0px'; document.body.style.margin = '0px'; document.body.style.overflow = 'hidden'; /* i love full screen */ var w = canvas.width = window.innerWidth; var h = canvas.height = window.innerHeight; var ctx = canvas.getContext('2d'); /* i love bad short opts ^__^ like q or qwe */ var opts = { }; var gui = new dat.GUI(); function opt(name, value, min, max){ opts[name] = value; return gui.add(opts, name, min, max); } /* if code.before > ugly -> just.dont.read(below) // below worse... ==== let's begin. ==== */ opt('rect', true); opt('s', 0.216, 0.01, 0.36).random = true; opt('s2', 0.25, 0, 0.5).random = true; opt('s3', 0.5, 0, 2).random = true; opt('limit', 5, 1, 8).step(1); opt('random', true); opt('speed', 0.05, 0, 1); function lerp2(a, b, p, s){ var x = b[0]-a[0]; var y = b[1]-a[1]; return [ a[0] + x*p + -y*s, a[1] + y*p + x*s, ]; } function drawCurve(a, b, c){ if(opts.rect){ ctx.moveTo(a[0], a[1]); ctx.quadraticCurveTo(b[0], b[1], c[0], c[1]); }else{ ctx.moveTo(a[0], a[1]); ctx.lineTo(b[0], b[1]); ctx.lineTo(c[0], c[1]); } } function drawIt(a, b, limit){ if(--limit < 0) return; let s = opts.s; let m = lerp2(a, b, 0.5, 0); let c = lerp2(a, b, 0.5-opts.s2, s); let d = lerp2(a, b, 0.5-opts.s2, -s); let e = lerp2(a, b, 0.5+opts.s2, s); let f = lerp2(a, b, 0.5+opts.s2, -s); a = lerp2(c, d, 0.5, -opts.s3); b = lerp2(e, f, 0.5, opts.s3); ctx.beginPath(); drawCurve(c,a,d); drawCurve(d,m,c); drawCurve(e,b,f); drawCurve(f,m,e); drawCurve(c,m,e); drawCurve(d,m,f); ctx.stroke(); drawIt(c,d, limit); drawIt(e,f, limit); } function loop(){ ctx.clearRect(0,0, w,h); drawIt([0, h/2], [w, h/2], opts.limit); for(var i=0; i<gui.__controllers.length && opts.random; ++i){ var t = gui.__controllers[i]; if(!t.random) continue; t.setValue( opts[t.property]*(1-opts.speed) + t.newValue*opts.speed ); } requestAnimationFrame(loop); } function random(){ for(var i=0; i<gui.__controllers.length; ++i){ var t = gui.__controllers[i]; if(!t.random) continue; if( t.oldValue === undefined ) t.oldValue = opts[t.property]; t.newValue = (t.__max-t.__min) * Math.random() + t.__min; } } setInterval(random, 1000); random(); loop();
}, false);
Developer | Findoff |
Username | findoff |
Uploaded | October 03, 2022 |
Rating | 3.5 |
Size | 2,430 Kb |
Views | 24,288 |
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 |
Small orbitals | 2,218 Kb |
Through penises... | 2,057 Kb |
Elementary cellular automaton | 2,685 Kb |
The vortex | 3,730 Kb |
Linear-feedback shift register | 3,009 Kb |
Deflectors vs asteroids | 3,565 Kb |
Flawed text | 2,280 Kb |
Lightning | 2,284 Kb |
Screeps body calculator | 6,315 Kb |
Connected levers | 2,758 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 |
ECharts Version 3.0 - Bar Marker Chart | WebCodePro | 2,726 Kb |
Svg penguin | _massimo | 2,990 Kb |
CSS Link Icons with jQuery Titles | Nicwinn | 2,312 Kb |
UI Challenge - Budget Selector | AgentRR007 | 3,547 Kb |
Angular-HAML | Cwacht | 2,022 Kb |
Angular Route | Arun_v606 | 1,837 Kb |
Table border-collapse property | Maxds | 1,672 Kb |
Welcome | Nakome | 6,076 Kb |
Addthis_button | Esambino | 1,691 Kb |
Arrow Navigation | Hinducows | 1,973 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!