Back to Browse

Change image shape with clip-path | HTML, CSS, JavaScript [no SVGs]

3.9K views
Feb 13, 2022
5:31

In this video, I show you a quick and easy way to change the shape of an image using HTML, CSS and JavaScript - no SVGs required. πŸ’˜ Contents: πŸ’˜ 00:08 - Project overview 00:40 - Using clip-path to set the shape of an image 01:22 - Browser support for clip-path 01:37 - Setting up CSS variable for the clip-path 02:04 - Writing the JavaScript function to change the image shape 02:14 - Generating a random number with Math.random() and .length 02:46 - Using setProperty to change the image shape 03:12 - Ensuring that a new shape is selected on each click with a conditional πŸ”— Links: πŸ”— Clip-path generator: https://bennettfeely.com/clippy/ Can I Use: https://caniuse.com/ Change image shape using SVGs: https://www.youtube.com/watch?v=1KyvCgEulQQ -- const me = { name: "Leanne πŸ‘©πŸ»", passions: ["coffeeβ˜•οΈ", "code πŸ’»", "cats 🐱"], unpopular_opinion: "LOVES CSS ❀️", favorite_colors: ["hotpink", "orangered"], channel_aim: "Show the world that CSS is fun and web development rules! πŸ‘‘" } -- 🐀 Say hi on Twitter: https://twitter.com/RybaLeanne

Download

0 formats

No download links available.

Change image shape with clip-path | HTML, CSS, JavaScript [no SVGs] | NatokHD