效果图:
svg在线生成地址🎄,画完图之后直接 Ctrl+U生成代码,直接取其中<path/> 路径部分替换掉,就可以变成其他图案 🎉
代码如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
body,
html {
height: 100%;
}
body {
margin: 0;
display: flex;
justify-content: center;
align-items: center;
}
.box {
width: 580px;
height: 400px;
clip-path: url(#svgTextPath);
position: relative;
/* 背景底色 */
background: #ccc;
overflow: hidden;
}
.box::after{
content: '';
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
/* 最终填充颜色 */
background: #222222;
transform: translateY(100%);
animation: move 3s linear both 1;
}
@keyframes move {
100%{
transform: translateY(0%);
}
}
svg{
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div class="box">
<svg width="0" height="0">
<defs>
<clipPath id="svgTextPath">
<path id="svg_1" d="m301.89139,149.6983c-7.49699,1.38055 -9.98695,7.65968 -10.08411,11.25001c4.12131,0.29825 6.70391,-2.03128 7.75457,-3.39376c1.71947,-1.93412 2.13522,-4.65681 2.32954,-7.85625zm0.92187,12.40235c-5.42052,0 -8.44824,2.2143 -9.93724,2.23916c-1.71495,-0.13331 -6.70391,-2.13974 -9.61414,-2.17137c-10.19031,0.30277 -13.10505,11.37654 -12.97852,16.13729c0.82923,18.2228 11.95045,22.92932 13.76708,23.36992c1.45963,0.28696 6.37402,-2.24819 9.98695,-2.1307c3.94733,0.41123 6.70843,2.04484 8.29007,1.93187c2.00869,-0.14009 8.54766,-5.42278 10.52019,-13.57277c-3.97219,-3.35986 -6.42599,-6.40792 -6.64516,-9.29555c-0.10394,-1.30825 1.86408,-8.69904 4.99799,-10.77552c0.4519,-2.55323 -4.20265,-5.79334 -7.85399,-5.72103c-0.18076,-0.00678 -0.357,-0.0113 -0.53324,-0.0113z" stroke-width="1.5" stroke="#000" fill="#fff"/>
</clipPath>
</defs>
</svg>
</div>
</body>
</html>