Bezier curve art
How do I make an bezier curve art?
Messing around and this happened, looks purdy.. What is a bezier curve art? How do you make a bezier curve art? This script and codes were developed by Loktar on 20 August 2022, Saturday.
Bezier curve art - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Bezier curve art</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <canvas></canvas> <script src="js/index.js"></script>
</body>
</html>
Bezier curve art - Script Codes CSS Codes
body{background:#000; overflow:hidden;}
canvas{position:absolute; top:0;left:0}
Bezier curve art - Script Codes JS Codes
var canvas = document.querySelector('canvas'), ctx = canvas.getContext('2d'), width = window.innerWidth, height = window.innerHeight, lines = [], cycle = 9; canvas.width = width; canvas.height = height; ctx.strokeStyle = "rgb(255,255,255)"; ctx.fillStyle = "rgba(0,0,0,0.01)"; init(); function init() { lines = []; for (var i = 0; i < 10; i++) { newLine(); } } function newLine() { lines.push({ x1: width / 2, y1: height, cp1x: width / 2 - Math.random() * width / 2, cp1y: height / 2 - Math.random() * height / 2, cp2x: width - Math.random() * width, cp2y: height - Math.random() * height, x2: width - Math.random() * width, y2: -height / 2, rotation: Math.random() * 360, angle1: Math.random() * 10, angle2: Math.random() * 10, angle3: Math.random() * 10 }); } function render() { ctx.strokeStyle = colorCycle(); for (var i = 0; i < lines.length; i++) { var line = lines[i]; line.cp1x += Math.sin(line.angle1 += 0.005); line.cp1y += Math.sin(line.angle1); line.cp2y -= Math.sin(line.angle2 -= 0.005); line.cp2x -= Math.sin(line.angle2); line.x1 -= Math.sin(line.angle3 += 0.005); line.y1 -= Math.sin(line.angle3); line.x2 -= Math.sin(line.angle3 += 0.005); line.y2 -= Math.sin(line.angle3); ctx.save(); ctx.beginPath(); ctx.moveTo(line.x1, line.y1); ctx.bezierCurveTo(line.cp1x, line.cp1y, line.cp2x, line.cp2y, line.x2, line.y2); ctx.stroke(); ctx.restore(); } requestAnimationFrame(render); } function colorCycle() { cycle += .01; if (cycle > 100) { cycle = 0; } var r = Math.floor(Math.sin(.3 * cycle + 0) * 127 + 128), g = Math.floor(Math.sin(.3 * cycle + 2) * 127 + 128), b = Math.floor(Math.sin(.3 * cycle + 4) * 127 + 128), a = Math.random() * 1; return "rgba(" + r + "," + g + "," + b + "," + 0.1 + ")"; } render();
Developer | Loktar |
Username | loktar00 |
Uploaded | August 20, 2022 |
Rating | 4.5 |
Size | 2,185 Kb |
Views | 60,720 |
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 |
Planets with points | 2,383 Kb |
Exploding 3D Clock | 3,538 Kb |
Pastel paint dripping | 2,852 Kb |
Tribute to the C64 | 31,811 Kb |
Javascript 2d dynamic lighting | 3,081 Kb |
Part 2 platformer tutorial | 2,911 Kb |
Rough Seas re-creation for compo | 3,643 Kb |
Slime Text | 3,861 Kb |
Meteor Shower | 2,866 Kb |
Smoke Particles | 7,564 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 |
Draggable directive | YahyaKacem | 2,277 Kb |
CSS Variables | Jdsteinbach | 4,759 Kb |
Process Accordion | Devilskitchen | 31,432 Kb |
Guage | Roygwells | 5,653 Kb |
Siema - add pagination to prototype | Pawelgrzybek | 2,575 Kb |
Slide like Mailbox | Hmps | 3,758 Kb |
Animate a paper plane along an SVG path, looking ahead | PotatoDie | 3,734 Kb |
Css3 only dropdown menu | Riogrande | 2,519 Kb |
Rotating Preloader with Anime.js | Tamashi | 2,450 Kb |
Count checked checkboxes with jQuery | Mestika | 2,343 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!