Multiple CSS Backgrounds
How do I make an multiple css backgrounds?
What is a multiple css backgrounds? How do you make a multiple css backgrounds? This script and codes were developed by Aitor on 16 September 2022, Friday.
Multiple CSS Backgrounds - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Multiple CSS Backgrounds</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <script src="js/index.js"></script>
</body>
</html>
Multiple CSS Backgrounds - Script Codes CSS Codes
html,
body { width: 100%; height: 100%; background: #000;
}
Multiple CSS Backgrounds - Script Codes JS Codes
"use strict";
function createBackground(depth) { return new Promise(function (resolve, reject) { var canvas = document.createElement("canvas"); canvas.width = 256; canvas.height = 256; var context = canvas.getContext("2d"); context.clearRect(0, 0, canvas.width, canvas.height); for (var i = 0; i < 100; i++) { var x = Math.random() * canvas.width; var y = Math.random() * canvas.height; context.fillStyle = "rgb(" + depth + "," + depth + "," + depth + ")"; context.fillRect(x, y, 1, 1); } canvas.toBlob(function (blob) { return resolve(URL.createObjectURL(blob)); }, "image/png"); });
}
var bgs = [];
var sx = 0, sy = 0;
function frame() { sx += 2; sy += 2; document.body.style.backgroundPositionX = bgs.map(function (bg, index, list) { return sx * (index + 1) * (1 / list.length) + "px"; }).join(","); document.body.style.backgroundPositionY = bgs.map(function (bg, index, list) { return sy * (index + 1) * (1 / list.length) + "px"; }).join(","); requestAnimationFrame(frame);
}
Promise.all([createBackground(128), createBackground(192), createBackground(256)]).then(function (_ref) { var bg0 = _ref[0]; var bg1 = _ref[1]; var bg2 = _ref[2]; requestAnimationFrame(frame); bgs.push([bg0], [bg1], [bg2]); document.body.style.backgroundImage = bgs.map(function (_ref2) { var url = _ref2[0]; return "url(" + url + ")"; }).join(","); console.log(bg0, bg1, bg2);
});
Developer | Aitor |
Username | AzazelN28 |
Uploaded | September 16, 2022 |
Rating | 4 |
Size | 2,980 Kb |
Views | 36,432 |
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 |
Dancing Text | 3,761 Kb |
Physics 101 | 6,491 Kb |
Countdown | 3,558 Kb |
Circuitry | 2,541 Kb |
AudioContext Concept | 3,112 Kb |
Galaxy Preview | 4,802 Kb |
Follow the lines | 2,645 Kb |
Fire | 3,542 Kb |
WebGL Point Sprites | 4,816 Kb |
Clock | 4,267 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 |
Sticky notes with CSS3 | HaiNguyen007 | 2,146 Kb |
Resume | Rottingroom | 5,483 Kb |
CSSOff 2013 Submission | Codewunder | 14,766 Kb |
Add This API | ThatGuySam | 2,848 Kb |
Nested table email layout | Massimo-cassandro | 2,355 Kb |
A Pen by Rob Levin | Roblevin | 2,787 Kb |
A Pen by Adrien Clerbois | AClerbois | 6,501 Kb |
A form arranged using automatic placement. | Vikasford | 2,103 Kb |
Countdown with Rings | Ewganoel | 2,490 Kb |
Snow collision | Wojtek1150 | 3,542 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!