HTML _CSS
Broken Effect
HiroDaegu
2022. 7. 18. 00:41
728x90
SMALL
https://bennettfeely.com/clippy/
Clippy — CSS clip-path maker
About Clip Paths The clip-path property allows you to make complex shapes in CSS by clipping an element to a basic shape (circle, ellipse, polygon, or inset), or to an SVG source. CSS Animations and transitions are possible with two or more clip-path shape
bennettfeely.com
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>BROKEN EFFECT</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="box">
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</body>
</html>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: #222;
}
.box {
position: relative;
width: 400px;
height: 300px;
background-color: #FFF;
}
.box span {
position: absolute;
inset: 0;
transition: .5s;
background:url('./image2.jpg');
background-size: cover;
}
.box span:nth-child(1) {
clip-path: polygon(0 0, 50% 0%, 50% 50%, 0 50%);
transition-delay: 0;
}
.box span:nth-child(2) {
clip-path: polygon(50% 0, 100% 0, 100% 50%, 50% 50%);
transition-delay: .25s;
}
.box span:nth-child(3) {
clip-path: polygon(0 50%, 50% 50%, 50% 100%, 0 100%);
transition-delay: .5s;
}
.box span:nth-child(4) {
clip-path: polygon(50% 50%, 100% 50%, 100% 100%, 50% 100%);
transition-delay: .75s;
}
.box:hover span:nth-child(1) {
transform: translate(-40px, -60px) rotate(-15deg);
}
.box:hover span:nth-child(2) {
transform: translate(40px, -100px) rotate(25deg);
}
.box:hover span:nth-child(3) {
transform: translate(-40px, 80px) rotate(15deg);
}
.box:hover span:nth-child(4) {
transform: translate(40px, 80px) rotate(-15deg);
}
728x90
LIST