.container
// 雪碧圖(總寬度 2880px,共 8 幀)
img(src="https://i.imgur.com/5aXROc2.png", alt="")
View Compiled
.container
width: 360px // 總寬度 2880px / 8幀
overflow: hidden
animation: moveContainer 5s infinite linear
img
margin-top: 80px
animation: run 0.5s infinite steps(8) // 8 幀
@keyframes run
0%
transform: translateX(0px)
100%
transform: translateX(-2880px) // 總寬度 2880px
// 移動 container,製造出「往前跑」的效果
@keyframes moveContainer
0%
transform: translateX(0px)
100%
transform: translateX(1600px)
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.