Retro Fractal

Size
2,685 Kb
Views
24,288

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 Previews

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);
Retro Fractal - Script Codes
Retro Fractal - Script Codes
Home Page Home
Developer Tiffany Rayside
Username tmrDevelops
Uploaded September 29, 2022
Rating 3.5
Size 2,685 Kb
Views 24,288
Do you need developer help for Retro Fractal?

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!

Tiffany Rayside (tmrDevelops) Script Codes
Name
3D Pyramid
The Net
Responsive Image Blog
Transference
Deliquescent
Shattered
Fractal Cell
LED Marquee
Jiggle
Psychotomimetic
Create amazing web content with AI!

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!