gsap结合svg实现ps钢笔绘画效果代码
代码语言:html
所属分类:拖放
代码描述:gsap结合svg实现ps钢笔绘画效果代码,有音效
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
body {
height: 100vh;
display: grid;
place-items: center;
color: #1f2933;
background: hsl(0, 0%, 100%);
}
.canvas {
position: relative;
/* max-width: 32rem;
aspect-ratio: 1/1; */
width: 100vw;
height: 100vh;
}
.canvas__svg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: visible;
}
.canvas__svg-bg {}
.canvas__controls {
position: absolute;
bottom: 1.5rem;
left: 50%;
display: flex;
transform: translateX(-50%);
z-index: 2;
}
.canvas__btn {
width: 2.75rem;
height: 2.75rem;
margin-right: 1rem;
border: none;
cursor: pointer;
background: none;
}
.canvas__btn:last-of-type {
margin-right: 0;
}
.canvas__btn-icon {
width: 24px;
height: 24px;
fill: none;
stroke-width: 1.5;
stroke: currentColor;
stroke-linecap: round;
stroke-linejoin: round;
}
.canvas__shape {
fill: none;
stroke: currentColor;
stroke-width: 3;
}
.canvas__dummy-shape {
fill: none;
stroke: #7b8794;
stroke-dasharray: 4;
stroke-width: 2;
vector-effect: non-scaling-stroke;
pointer-events: none;
}
.canvas__point {
stroke: #000;
stroke-width: 3;
fill: #fff;
/* vector-effect: non-scaling-stroke; */
}
.closed .canvas__point[data-index="0"] {
fill: #fff;
}
.canvas__btn--active {
color: #1f2933;
}
</style>
</head>
<body>
<div class="canvas">
<svg class="canvas__svg" viewBox="0 0 1920 1080" preserveAspectRatio="xMidYMid slice"></svg>
<div class.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0