html - 向页面添加更多部分后,CSS 动画变慢/未完成
问题描述
我在嵌入元素中添加到 Webflow 站点的 CSS 动画时遇到问题。在我向页面添加更多部分之前,动画播放得更快并且动画完全完成。现在在网站上工作并添加更多部分后,动画很慢,有些没有完成。
这是我正在使用的嵌入式代码,如果有人能告诉我为什么会这样,我将不胜感激:)
我猜代码是针对身体的?这就是为什么在添加更多部分时动画会变得混乱的原因?
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" style="height:64px;width:64px">
<path fill="none" stroke="currentColor" stroke-width="2" stroke-miterlimit="10" d="M18 1h28v61L32 48 18 62z" stroke-dasharray="190,192"/>
<path fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="bevel" stroke-miterlimit="10" d="M23 22l7 7 13-13" stroke-dasharray="29,31"/>
</svg>
<style>
selector {
property: value;
}
svg {
height: 100%;
width: 100%;
}
path {
stroke-dasharray: 300
;
animation: draw 2s normal;
}
@keyframes draw {
from {
stroke-dashoffset: 300
}
to {
stroke-dashoffset: 100%;
}
}
</style>
解决方案
您正在寻找的是动画速度。尝试这个:
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" style="height:64px;width:64px">
<path fill="none" stroke="currentColor" stroke-width="2" stroke-miterlimit="10" d="M18 1h28v61L32 48 18 62z" stroke-dasharray="190,192"/>
<path fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="bevel" stroke-miterlimit="10" d="M23 22l7 7 13-13" stroke-dasharray="29,31"/>
</svg>
<style>
svg {
height: 100%;
width: 100%;
}
path {
stroke-dasharray: 300px;
;
animation: draw 5s normal; /*Change the speed right here*/
}
@keyframes draw {
from {
stroke-dashoffset: 300px;
}
to {
stroke-dashoffset: 100%;
}
}
</style>
推荐阅读
- sql-server - 二父表一子表关系
- svelte - 如何绑定苗条的动态组件值
- ios - 使用 AudioConverter 将 PCM 转换为 AAC 并使用 AVAssetWriter 写入 .mp4 文件时音频失真
- copy-paste - tmux 中的鼠标选择将所有选择的内容连接到剪贴板
- if-statement - 根据值设置的百分比计算成功率
- java - 在某些情况发生后停止线程 ScheduledThreadPoolExecutor
- prolog - 为什么它说我的谓词 block/3 没有被调用?
- c++ - 命名空间中模板运算符的重载解决方案
- tensorflow - 关闭 tensorflow 签名
- python - 使用 matplotlib 的条形图动画