CSGO image overlay using clip path

Developer
Size
2,794 Kb
Views
267,168

How do I make an csgo image overlay using clip path?

I tried to recreate the Counter Strike Global Offensive map thumbnail overlay from the ingame lobby. I'd like to make it dynamic so you can select how many images you want to see. Maybe in a few days... :). What is a csgo image overlay using clip path? How do you make a csgo image overlay using clip path? This script and codes were developed by Joost Jansen on 19 November 2022, Saturday.

CSGO image overlay using clip path Previews

CSGO image overlay using clip path - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>CSGO image overlay using clip path</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> <div class="maps"> <img src="http://placehold.it/400x400" class="map" /> <img src="http://placehold.it/400x400" class="map" /> <img src="http://placehold.it/400x400" class="map" /> <img src="http://placehold.it/400x400" class="map" /> <img src="http://placehold.it/400x400" class="map" />
</div> <script src="js/index.js"></script>
</body>
</html>

CSGO image overlay using clip path - Script Codes CSS Codes

html,
body { height: 100%;
}
body { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center;
}
.maps { height: 500px; width: 800px; position: relative; box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}
.maps img.map { height: 100%; position: absolute; top: 0; left: 0;
}

CSGO image overlay using clip path - Script Codes JS Codes

const mapsImages = document.querySelectorAll('img.map');
const mapsUrls = [ "https://4.bp.blogspot.com/-mQBVLSZx764/VhIrU_je81I/AAAAAAAAAC8/0fdO-W6pUzw/s1600/CSGO_Dust2_B_2_10_July_2014_Update.jpg", "http://teambeyond.net/wp-content/uploads/2015/03/CS-GO-Cobblestone.jpg", "http://vignette3.wikia.nocookie.net/cswikia/images/0/0f/Csgo-de-inferno.png", "http://vignette4.wikia.nocookie.net/cswikia/images/9/91/Csgo_shorttrain_big.jpg/revision/latest?cb=20130420150941", "http://static.hltv.org/images/galleries/7477-medium/1451261300.3293.jpeg"
];
const widthRegular = 1 / mapsImages.length * 100;
const widthLast = widthRegular + 10;
Array.from(mapsImages).forEach((m, i) => { const isLastPolygon = i === mapsImages.length - 1; const width = isLastPolygon ? widthLast : widthRegular; const x1 = i * widthRegular; const x2 = Math.min(100, x1 + width); const x4 = Math.max(-10, x1 - 10); const x3 = x4 + width; const result = `polygon(${x1}% 0, ${x2}% 0, ${x3}% 100%, ${x4}% 100%)`; m.style.clipPath = result; m.style.zIndex = `${mapsImages.length - i + 1}`; m.src = mapsUrls[i];
});
CSGO image overlay using clip path - Script Codes
CSGO image overlay using clip path - Script Codes
Home Page Home
Developer Joost Jansen
Username DevItWithDavid
Uploaded November 19, 2022
Rating 3
Size 2,794 Kb
Views 267,168
Do you need developer help for CSGO image overlay using clip path?

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!

Joost Jansen (DevItWithDavid) Script Codes
Create amazing blog posts 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!