Canvas Night Sky
How do I make an canvas night sky?
A random night sky. What is a canvas night sky? How do you make a canvas night sky? This script and codes were developed by Tamuna on 03 January 2023, Tuesday.
Canvas Night Sky - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Canvas Night Sky</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <canvas id="sky"></canvas> <script src="js/index.js"></script>
</body>
</html>
Canvas Night Sky - Script Codes CSS Codes
html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden;
}
#sky { background: -webkit-linear-gradient(#00111e 30%, #033d5e); background: -moz-linear-gradient(#00111e 30%, #033d5e); background: -o-linear-gradient(#00111e 30%, #033d5e); background: linear-gradient(#00111e 30%, #033d5e); overflow: hidden;
}
Canvas Night Sky - Script Codes JS Codes
function drawing() { var c = document.getElementById('sky'); var ctx = c.getContext('2d'); var xMax = c.width = window.screen.availWidth; var yMax = c.height = window.screen.availHeight; var hmTimes = Math.round(xMax + yMax); for(var i=0; i<=hmTimes; i++) { var randomX = Math.floor((Math.random()*xMax)+1); var randomY = Math.floor((Math.random()*yMax)+1); var randomSize = Math.floor((Math.random()*2)+1); var randomOpacityOne = Math.floor((Math.random()*9)+1); var randomOpacityTwo = Math.floor((Math.random()*9)+1); var randomHue = Math.floor((Math.random()*360)+1); if(randomSize>1) { ctx.shadowBlur = Math.floor((Math.random()*15)+5); ctx.shadowColor = "white"; } ctx.fillStyle = "hsla("+randomHue+", 30%, 80%, ."+randomOpacityOne+randomOpacityTwo+")"; ctx.fillRect(randomX, randomY, randomSize, randomSize); }
}
drawing();
Developer | Tamuna |
Username | AlienPiglet |
Uploaded | January 03, 2023 |
Rating | 4.5 |
Size | 1,956 Kb |
Views | 12,144 |
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 |
Lime Form | 2,153 Kb |
Monochrome Form | 3,096 Kb |
Spin Around the Cursor | 2,314 Kb |
Starry Night of Markup | 3,023 Kb |
Pink and Blue | 2,312 Kb |
Simple Counter | 2,416 Kb |
Anbani Flashcards | 5,294 Kb |
CSS Clock | 2,513 Kb |
Creamy Form | 2,651 Kb |
Rotating Menu | 1,858 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 |
CSS3 Form | Tusharbandal | 1,836 Kb |
Donut Chart example - MorrisJS | Capelo | 2,385 Kb |
Two Element Typeface | Chrisota | 4,942 Kb |
Material design buttons | Fischaela | 4,381 Kb |
Responsive Boxes without Images | Andymcfee | 4,120 Kb |
React Recipe Box | Krokodill | 5,347 Kb |
Responsive Pricing Table | Jeremycaris | 2,690 Kb |
Draggables in pure angular | Rlo206 | 5,167 Kb |
Foundation 5 Menu - Accessibility | Xporter | 1,999 Kb |
Incremental game | Eprouver | 5,868 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!