html - 使用动画将图像添加到 svg 形状
问题描述
我想将图像添加到我的 svg 形状(圆形),但它没有完全显示图像。圆圈有一个在路径中移动的动画。我可以在 svg 形状中添加一个滑块,所以每次它显示不同的图像
.marker {
motion-path: path('M 5.1 22.1 m 18, 0 a 18,18 0 1,0 -36,0');
offset-path: path('M 5.1 22.1 m 18, 0 a 18,18 0 1,0 -36,0');
animation: move 9s linear infinite;
}
@keyframes move {
100% {
motion-offset: 100%;
offset-distance: 100%;
}
}
<svg class="align-self-end" viewbox="0,0 10,10" width="100%" height="100%">
<defs >
<pattern id="img1" patternUnits="userSpaceOnUse" width="100%" height="100%">
<image xlink:href="image/720x469-imperial-hotel-rooms-standard-double-5_04.jpg " width="100%" height="100%" />
</pattern>
</defs>
<path
fill="none"
stroke-width="0.1"
stroke="#000000"
stroke-dasharray="0.5,0.2"
d="M 5.1 22.1 m 18, 0 a 18,18 0 1,0 -36,0"
/>
<circle
class="marker"
stroke-width="0.1"
stroke="#000000"
stroke-dasharray="0.5,0.2"
r="3.2"
fill="url(#img1)"
/>
</svg>
解决方案
推荐阅读
- c++ - 在同一个线程的同一个实例上多次调用 shared_future::get() 是否合法?
- javascript - 在 useEffect 中反应 setState 导致无限渲染周期
- javascript - 全局设置请求标头
- python - 如何复制熊猫数据框以匹配其他数据框的长度?
- android - ClassNotFoundException:找不到类“kotlin.jvm.internal.Lambda”
- php - 如何使用 php、ajax、jquery 和下拉菜单使页面以正确的顺序显示产品
- python - 具有多个守护进程的 Apache mod_wsgi 内存缓存
- geospatial - 如何在 Google 地球引擎上可视化上传的图像
- docker - 将 SoftHSM 库暴露给在主机中运行的代码
- sql-server - 用于操作 SQL 备份的 DevOps 或 SQLDataFactory 管道