Randomly generated canvas clouds
How do I make an randomly generated canvas clouds?
Randomly generated quadratic curves to create "clouds".. What is a randomly generated canvas clouds? How do you make a randomly generated canvas clouds? This script and codes were developed by Dave DeHaan on 04 January 2023, Wednesday.
Randomly generated canvas clouds - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Randomly generated canvas clouds</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <center> <canvas id="canvas" width="1000" height="400"> </canvas>
</center> <script src="js/index.js"></script>
</body>
</html>
Randomly generated canvas clouds - Script Codes CSS Codes
body { padding: 0px; margin: 0px; background: #ecf0f1;
}
#canvas { background: #3498db; width: 100%; height: 400px;
}
Randomly generated canvas clouds - Script Codes JS Codes
/* * Start Config Vars */
var yPosMax = 175;
var yPosMin = 125;
var yPosStart = 150;
var xPosStart = -50;
var yPosChangeMultiplier = 60;
var xPosChangeMin = 125;
var xPosChangeMultiplier = 25;
var yControlMultiplier = 20;
var yControlMin = 40;
/* * End Config Vars */
canvas = document.getElementById('canvas');
context = canvas.getContext('2d');
context.fillStyle = '#ecf0f1';
var xPos = xPosStart;
var yPos = yPosStart;
context.beginPath();
context.moveTo(xPos, yPos);
while (xPos < canvas.width) { lastX = xPos; xPos += Math.floor(Math.random() * xPosChangeMultiplier + xPosChangeMin); yPos += Math.floor(Math.random() * yPosChangeMultiplier - yPosChangeMultiplier/2); while (yPos < yPosMin) { yPos += Math.floor(Math.random() * yPosChangeMultiplier/2); } while (yPos > yPosMax) { yPos -= Math.floor(Math.random() * yPosChangeMultiplier/2); } controlX = (lastX + xPos)/2; controlY = yPos-Math.floor(Math.random() * yControlMultiplier + yControlMin); context.quadraticCurveTo(controlX,controlY,xPos,yPos);
}
context.lineTo(canvas.width,yPos);
context.lineTo(canvas.width,canvas.height);
context.lineTo(0,canvas.height);
context.fill();
Developer | Dave DeHaan |
Username | davedehaan |
Uploaded | January 04, 2023 |
Rating | 3.5 |
Size | 2,028 Kb |
Views | 10,120 |
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 |
Tween Bubbles. | 2,175 Kb |
Yule Logs | 1,496 Kb |
Multi-color Text using globalCompositeOperation | 1,983 Kb |
Unblur on scroll | 1,930 Kb |
Spotlight Search 404 | 3,033 Kb |
HTML5 Logo Tracing | 2,301 Kb |
Dynamic Hero Image | 2,435 Kb |
More Fun with Lines | 3,118 Kb |
A Pen by Dave DeHaan | 2,015 Kb |
Unblur on Page Load | 2,048 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 |
TweetBox with React JS | J0zelito | 3,325 Kb |
Twitch API | Coderpilot | 3,412 Kb |
Pure CSS Tooltips | Mobius1 | 2,271 Kb |
Simple Accordion | Wearebold | 3,683 Kb |
Jstam.com Home Page | Jstam | 10,558 Kb |
CSS- UI Element States Pseudo-Classes | Tesla809 | 2,206 Kb |
Responsive Advert | James_zedd | 2,354 Kb |
A Pen by Anoop | Anoopjohn | 330,760 Kb |
Practice using Wixel | Emnk | 3,057 Kb |
Elephants Full screen site | Orrinward | 3,981 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!