Retro Fractal
How do I make an retro fractal?
#retroTilesWeekend [ Pen #2 ]A rectangular fractal pattern that changes on click / tap.The Blog PostInspiration: . What is a retro fractal? How do you make a retro fractal? This script and codes were developed by Tiffany Rayside on 29 September 2022, Thursday.
Retro Fractal - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Retro Fractal</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> <p>Retro Fractal<br> <span class = 'i'>Click / Tap for New Tile Pattern</span>
</p>
<canvas id='canv'></canvas> <script src="js/index.js"></script>
</body>
</html>
Retro Fractal - Script Codes CSS Codes
@import url(https://fonts.googleapis.com/css?family=Bubblegum+Sans);
body{ width:100%; overflow:hidden; margin:0; -webkit-user-select:none; -moz-user-select:none; -ms-user-select:none; user-select:none; cursor:pointer; background:hsla(0,0%,10%,1);
}
p{ width:100%; top:35%; left:0; position:absolute; text-align:center; font-family: 'Bubblegum Sans', cursive; font-size:4em; letter-spacing:5px; z-index:1; color:hsla(56, 95%, 95%, 1);
}
span.i{ font-size:30%;
}
canvas{ z-index:0;
}
Retro Fractal - Script Codes JS Codes
var c = document.getElementById('canv');
var $ = c.getContext('2d');
var w = c.width = window.innerWidth;
var h = c.height = window.innerHeight;
var tile = (function() { tile.prototype.rects = null; tile.prototype.divved = false; function tile(x, y, w, h) { this.x = x; this.y = y; this.w = w; this.h = h; } tile.prototype.div = function() { this.t = []; if (this.w > this.h) { this.t[0] = new tile(this.x, this.y, this.w / 2, this.h); this.t[1] = new tile(this.x + this.w / 2, this.y, this.w / 2, this.h); } else { this.t[0] = new tile(this.x, this.y, this.w, this.h / 2); this.t[1] = new tile(this.x, this.y + this.h / 2, this.w, this.h / 2); } return this.divved = true; }; return tile;
})();
var draw = function() { var j, k, l, t, tiles, lay; t = new tile(0, 0, w, h); tiles = [t]; for( k = 1; k <= 40; ++k) { j = Math.random() * tiles.length | 0; t = tiles[j]; t.div(); tiles.splice(j, 1, t.t[0], t.t[1]); } lay = []; for (l in tiles) { t = tiles[l]; $.beginPath(); $.rect(t.x, t.y, t.w, t.h); $.fillStyle = 'hsla(' + Math.floor(280 * Math.random()) + ', 40%, 50%, 1)'; $.closePath(); lay.push($.fill()); } return lay;
};
window.addEventListener('resize',function(){ c.width = window.innerWidth; c.height = window.innerHeight; draw();
}, false)
window.requestAnimationFrame(draw);
window.addEventListener('mousedown', draw, false);
window.addEventListener('touchstart', function(e){ draw(); e.preventDefault();
}, false);
Developer | Tiffany Rayside |
Username | tmrDevelops |
Uploaded | September 29, 2022 |
Rating | 3.5 |
Size | 2,685 Kb |
Views | 24,288 |
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 |
3D Pyramid | 3,057 Kb |
The Net | 2,153 Kb |
Responsive Image Blog | 6,496 Kb |
Transference | 3,021 Kb |
Deliquescent | 3,211 Kb |
Shattered | 3,037 Kb |
Fractal Cell | 2,507 Kb |
LED Marquee | 3,769 Kb |
Jiggle | 2,064 Kb |
Psychotomimetic | 2,314 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 |
Blackberry Mock | Zacharyolson | 1,865 Kb |
Simple jQuery Slider | Jurbank | 2,874 Kb |
Marching Squares Visualized | Sakri | 7,074 Kb |
Smoke Shader - Frame Buffer | Omarshe7ta | 2,672 Kb |
Tumblr API | Juanv911 | 2,436 Kb |
Transition | Shayhowe | 1,632 Kb |
No Vacancy 404 CSS Only | Sethkontny | 0 Kb |
Two Element Typeface | Chrisota | 4,942 Kb |
Static Image to Video Block | Grayghostvisuals | 4,864 Kb |
Off Canvas | Mariamarica | 1,870 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!