Geometric Pattern Mask
How do I make an geometric pattern mask?
CSS mask over a canvas pattern. Yay, masks!. What is a geometric pattern mask? How do you make a geometric pattern mask? This script and codes were developed by Val Head on 07 August 2022, Sunday.
Geometric Pattern Mask - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Geometric Pattern Mask</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="wrap"> <div> <canvas id="type" width="655" height="125" />
</div>
<div class="shadow"></div>
</div> <script src="js/index.js"></script>
</body>
</html>
Geometric Pattern Mask - Script Codes CSS Codes
body { background: #2e292e; margin: 0; text-align:center;
}
#type { background:#f8fc8e; -webkit-mask-image: url('https://dl.dropbox.com/u/1143870/geometric.png'); -webkit-mask-repeat: no-repeat; position:absolute; top:0; left:0;
}
.wrap { position:relative; width:655px; margin:2em auto; }
.shadow { width:655px; height:125px; background:url('https://dl.dropbox.com/u/1143870/geo_innershadow.png') top left no-repeat; position:absolute; top:0 left:0; }
Geometric Pattern Mask - Script Codes JS Codes
var SCREEN_WIDTH = window.innerWidth, SCREEN_HEIGHT = window.innerHeight, HALF_WIDTH = window.innerWidth / 2, HALF_HEIGHT = window.innerHeight / 2;
var colours =["rgba(255,162,153,.4)","rgba(236,252,142,.5)","rgba(157,248,180,.5)","rgba(151,241,153,.5)"],
squares=[],
MAX_SQUARES = 10;
var count=0, width=30, sX =0, sY =0, canvas, c;
setupCanvas();
function setupCanvas() { canvas = document.getElementById("type"); c = canvas.getContext("2d"); draw();
}
function draw() { MAX_SQUARES = (SCREEN_WIDTH/width) * (SCREEN_HEIGHT/width);
for (i=0; i<MAX_SQUARES; i++){ sX = width *count; if (count > SCREEN_WIDTH/width) { count =0; sX = 0 sY = sY + width; }
var s = new SplitSquare(sX,sY,width);
squares.push(s); s.colour01 = colours[Math.round(randomRange(0,3))];
s.colour02 = colours[Math.round(randomRange(0,3))];
s.render(c);
count ++;
}
count =0;
setInterval(loop, 1000 / 10);
}
function loop () { for (i=0; i<MAX_SQUARES; i++){ s=squares[i]; s.colour01 = colours[Math.round(randomRange(0,3))]; s.colour02 = colours[Math.round(randomRange(0,3))]; s.render(c); } }
function randomRange(min, max) { return ((Math.random()*(max-min)) + min);
}
function SplitSquare(posx, posy, size) { this.posX = posx; this.posY = posy; this.size = size; this.colour01; this.colour02; this.render = function(c) { c.fillStyle = this.colour02; c.save(); c.translate(this.posX, this.posY); c.beginPath(); c.moveTo(0, 0); c.lineTo(0, this.size); c.lineTo(this.size,this.size); c.closePath(); c.fill(); c.fillStyle = this.colour01; c.beginPath(); c.moveTo(0,0); c.lineTo(this.size, 0); c.lineTo(this.size, this.size); c.closePath(); c.fill(); c.restore(); };
}
Developer | Val Head |
Username | valhead |
Uploaded | August 07, 2022 |
Rating | 4.5 |
Size | 2,527 Kb |
Views | 26,312 |
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 |
Net magazine demo - Step 3 | 5,295 Kb |
Spring physics with CSS variables | 3,591 Kb |
Neon glow letters | 2,595 Kb |
Listening for CSS animation events | 2,665 Kb |
Net magazine example - Start | 4,830 Kb |
You are getting very sleepy... | 3,242 Kb |
Nav animation exercise - START | 3,402 Kb |
500 coffee cup icons | 3,169 Kb |
Steps Sprite Animation | 1,942 Kb |
3D dancing dots | 2,334 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 |
IE flex collapse bug fix | Rowno | 2,678 Kb |
Infractions - Attitude | Kylie_Joseph | 7,672 Kb |
Konami Code Easter Egg | Teolitto | 3,051 Kb |
Ipad Mini Showcase | Hornebom | 10,479 Kb |
Base-Style | Daniel_gooss | 2,614 Kb |
Weather App | Kw7oe | 3,162 Kb |
A Pen by Andrea Verlicchi | Verlok | 2,018 Kb |
We Simplify animation | Meodai | 48,169 Kb |
Adding Items | Valhead | 4,008 Kb |
Wikipedia Viewer | Odylic | 2,333 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!