svg+js实现交互式多宫格图片分割点击效果代码
代码语言:html
所属分类:布局界面
代码描述:svg+js实现交互式多宫格图片分割点击效果代码,可切换效果。
代码标签: svg js 交互式 多宫格 图片 分割 点击 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
overflow: hidden;
height: 100vh;
width: 100vw;
position: relative;
background: #000;
}
.container {
width: 100vw;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.mosaic-container {
background: #2c3e50;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
position: relative;
}
#mosaic {
display: grid;
background-color: #34495e;
overflow: hidden;
box-shadow: 0 10px 30px rgb(0 0 0 / 0.3);
width: min(95vh, 95vw);
height: min(95vh, 95vw);
aspect-ratio: 1 / 1;
position: relative;
}
.tile {
background-size: cover;
background-repeat: no-repeat;
border: 1px solid rgb(255 255 255 / 0.2);
transition: all 0.3s ease;
cursor: pointer;
width: 100%;
height: 100%;
aspect-ratio: 1 / 1;
position: relative;
overflow: hidden;
}
.tile:hover {
transform: scale(1.1);
z-index: 10;
box-shadow: 0 0 20px rgb(52 152 219 / 0.8);
border: 2px solid #fff;
}
.tile.pop {
animation: pop 0.3s ease;
}
@keyframes pop {
0% {
transform: scale(1);
}
50% {
transform: scale(1.3);
z-index: 100;
}
100% {
transform: scale(1);
}
}
.tile.rotate {
animation: rotate 0.5s ease;
}
@keyframes rotate {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.toggle-controls-btn {
position: fixed;
top: 20px;
right: 20px;
width: 36px;
height: 36px;
border-radius: 50%;
background: rgb(52 152 219 / 0.3);
color: rgb(255 255 255 / 0.6);
border: 1px solid rgb(255 255 255 / 0.1);
cursor: pointer;
font-size: 18px;
display: flex;
align-items: center;
justify-content: center;
z-index: 1002;
transition: all 0.3s ease;
backdrop-filter: blur(4px);
padding: 0;
}
.toggle-controls-btn:hover {
background: rgb(52 152 219 / 0..........完整代码请登录后点击上方下载按钮下载查看
















网友评论0