Lorenz Attractor

Developer
Size
2,107 Kb
Views
129,536

How do I make an lorenz attractor?

A simple Lorenz Attractor renderer. Change the parameters for different results!. What is a lorenz attractor? How do you make a lorenz attractor? This script and codes were developed by Liabru on 31 August 2022, Wednesday.

Lorenz Attractor Previews

Lorenz Attractor - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Lorenz Attractor</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <!-- A simple Lorenz Attractor renderer by @liabru
-->
<canvas id="canvas" width="500" height="660"> <script src="js/index.js"></script>
</body>
</html>

Lorenz Attractor - Script Codes CSS Codes

body { background: #18181d; text-align: center;
}
canvas { display: inline-block; max-width: 100%; max-height: 100%;
}

Lorenz Attractor - Script Codes JS Codes

// A simple Lorenz Attractor renderer
// Change the parameters for different results!
// by @liabru - http://brm.io
var canvas = document.getElementById('canvas'), context = canvas.getContext('2d'), c = 28, h = 0.015, t = -6, x0 = 0, y0 = 1, z0 = 10, x1, y1, z1, cx = 250, cy = 330, scale = 15, n = 20000, i = 0;
var interval = setInterval(function() { if (i < n) { for (var k = 0; k < 20; k += 1) { x1 = x0 + h * t * (x0 - y0); y1 = y0 + h * (-x0 * z0 + c * x0 - y0); z1 = z0 + h * (x0 * y0 - z0); context.strokeStyle = "hsl(" + Math.abs(x1)*10 + "," + Math.abs(y1)*10 + "%," + Math.abs(z1)*2 + "%)"; context.beginPath(); context.moveTo(cx + x0 * scale, cy + y0 * scale); context.lineTo(cx + x1 * scale, cy + y1 * scale); context.stroke(); x0 = x1; y0 = y1; z0 = z1; i += 1; } } else { clearInterval(interval); }
}, 1);
Lorenz Attractor - Script Codes
Lorenz Attractor - Script Codes
Home Page Home
Developer Liabru
Username liabru
Uploaded August 31, 2022
Rating 3.5
Size 2,107 Kb
Views 129,536
Do you need developer help for Lorenz Attractor?

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!

Liabru (liabru) Script Codes
Name
Wrecking Ball Physics
Slingshot Game
Bridge Physics
Catapult
Gears
Ragdoll
Cars
Avalanche
Create amazing blog posts 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!