svg簡單動畫

    <style>
		.ball3 {
			animation: second-animation 2s 2s infinite alternate ease-in-out forwards;
		}
		@keyframes second-animation {
			0% {
				fill:blue;
				transform:translateX(0);
			}
			50% {
				fill:purple;
				transform:translateX(50x);
			}
			100% {
				fill:red;
				transform:translateX(100px);
			}
		}
    </style>
	<svg width="200px" height="70px" viewBox="0 0 200 70">
		<circle class="ball3" fill="black" cx="45" cy="45" r="25"></circle>
	</svg>

<circle>會在viewBox內運動。採用fill屬性外聯樣式。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章