这是我的代码,在body标记中,如docs中所指定的:
<amp-animation layout="nodisplay" trigger="visibility">
<script type="application/json">
[
{
"selector": ".shape-3",
"duration": 1000,
"delay": 0,
"keyframes": "buildInKeyframes",
"fill": "both",
"direction": "normal"
},
{
"selector": ".shape-3",
"duration": 1000,
"delay": 1200,
"keyframes": "buildOutKeyframes",
"fill": "both",
"direction": "normal"
}
]
</script>
</amp-animation>(在head标签中,我有用标签样式和自定义定义的关键帧)我有一个带有class=“first 3”的div,我想用第一个动画来动画它,在它完成之后,用第二个动画来动画。问题是
发布于 2022-01-07 07:56:11
您可以尝试以下列方式使用动画:
<amp-animation layout="nodisplay">
<script type="application/json">
{
"selector": ".shape-3",
"duration": "1s",
"iterations": "1",
"fill": "both",
"direction": "alternate",
"animations": [
{
"selector": ".target-class",
"easing": "cubic-bezier(0,0,.21,1)",
"keyframes": {
"transform": "rotate(20deg)"
}
},
{
"delay": "1s",
"easing": "cubic-bezier(0,0,.21,1)",
"keyframes": {
"transform": "rotate(30deg)"
}
}
]
}
</script>
</amp-animation>其中,第二动画的延迟是用于第一次动画的时间。
https://stackoverflow.com/questions/52093405
复制相似问题