Rain JS
How do I make an rain js?
JS and CSS Rain example. What is a rain js? How do you make a rain js? This script and codes were developed by WebSonick on 31 December 2022, Saturday.
Rain JS - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Rain JS</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <canvas></canvas>
<img class="blur hide" src="http://armsonick.zz.mu/Demos/ImageHost/images/1382968144FOREST-RAIN-default-beautiful-31001.jpg">
<img class="clean hide" src="http://armsonick.zz.mu/Demos/ImageHost/images/1382968101FOREST-RAIN-default-beautiful-31000.jpg"> <script src="js/index.js"></script>
</body>
</html>
Rain JS - Script Codes CSS Codes
body { background: #333; margin: 0; padding: 0;
}
.hide { display: none;
}
Rain JS - Script Codes JS Codes
(function (d) { window.addEventListener('load', function () { var c = d.querySelector('canvas'); var context = c.getContext('2d'); var blurred = d.querySelector('.blur'); var clean = d.querySelector('.clean'); var w = window.innerWidth; var h = window.outerHeight; var drops = []; var fps = 60; var dropMaxWidth = 30; c.width = w; c.height = h; console.log(w, h); var trails = []; for (var i = 0; i < 250; i++) { drops.push({ "x": Math.floor((Math.random() * w) + 1), "y": Math.floor((Math.random() * h) + 1), "d": Math.floor((Math.random() * dropMaxWidth) + 1), }); } function draw() { context.clearRect(0, 0, w, h); context.drawImage(blurred, 0, 0, w, h); drops.forEach(function (e) { e.x += .1; e.y += .11; e.d -= .02; if (e.x > w || e.x < 0) { e.x = Math.floor((Math.random() * w) + 1); } if (e.y > h || e.y < 0) { e.y = Math.floor((Math.random() * h) + 1); } if (e.d > dropMaxWidth || e.d < 0) { e.d = Math.floor((Math.random() * dropMaxWidth) + 1); } context.save(); context.beginPath(); context.arc(e.x+(e.d/2), e.y+(e.d/2), e.d/2, 0, Math.PI * 2, true); context.closePath(); context.clip(); context.drawImage(clean, e.x, e.y, e.d*2, e.d*2, e.x, e.y, e.d, e.d); context.beginPath(); context.arc(e.x, e.y, e.d/2, 0, Math.PI * 2, true); context.clip(); context.closePath(); context.restore(); if (Math.random() > .995) { trails.push({ "x": e.x, "y": e.y, "d": e.d / 5 }); } }); trails.forEach(function (t) { context.save(); context.beginPath(); context.arc(t.x+(t.d/2), t.y+(t.d/2), t.d/2, 0, Math.PI * 2, true); context.closePath(); context.clip(); context.drawImage(clean, t.x, t.y, t.d*2, t.d*2, t.x, t.y, t.d, t.d); context.beginPath(); context.arc(t.x, t.y, t.d/2, 0, Math.PI * 2, true); context.clip(); context.closePath(); context.restore(); }); } setInterval(draw, 1000 / fps); });
})(document);
Developer | WebSonick |
Username | WebSonick |
Uploaded | December 31, 2022 |
Rating | 3 |
Size | 2,303 Kb |
Views | 30,360 |
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 |
Blog Simple Web Page | 3,146 Kb |
Snow | 3,075 Kb |
Social Links | 2,175 Kb |
Jump Animated Text | 1,978 Kb |
World Map Navigation | 2,393 Kb |
In second lives - HTML5 CANVAS 3D demo | 5,514 Kb |
WebGL Geometry Text | 5,406 Kb |
Codepen on ge1doot.js | 3,296 Kb |
CSS3 Text Effect | 1,861 Kb |
JQuery Clock | 2,413 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 |
Border-radius animation | Yukulele | 2,480 Kb |
Side Sliding Menu CSS | EduardL | 4,388 Kb |
A Pen by Paul Sullivan | Pwsm50 | 2,349 Kb |
Simple jQuery Slider | Jurbank | 2,874 Kb |
Shopping cart | Andiio | 6,581 Kb |
Image Hover | Johnheiner | 3,409 Kb |
SVG Icons Template | Legofsalmon | 2,618 Kb |
WRENCH - STAFF | Lolita-adams | 1,608 Kb |
Donald Trump - The New Yorker | Agbales | 2,502 Kb |
IE flex collapse bug fix | Rowno | 2,678 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!