> > > > > > > > > > > >
不使用JavaScript。作者講述了他們建立僅CSS僅Wolfenstein 3D啟發的遊戲的經驗,突出了兩個特別棘手的動畫問題:觸發武器對敵人的點擊啟用武器發射動畫,並為老闆的最終命中實施巨大的慢動作。
圍繞Browsers的核心問題圍繞著瀏覽器的核心問題,圍繞著Browsers的動物處理狀態。 Simply adding or modifying animation properties while an animation is already running doesn't always restart or slow it down as expected.
Problem 1: Replaying Animations
The author explores several approaches to replaying animations:
Animation-Fill模式導致意外行為:forwards
。關鍵要點是您不能直接重新啟動CSS動畫;您必須添加一個新的。
問題2:慢動作
簡單地更改動畫效應
,而動畫正在運行會導致跳躍的刺激。 The browser applies the new duration from the animation's start, not its current state.
Several approaches are explored:
animation-duration
Change (Ineffective): Changing animation-duration
mid-animation causes visual glitches. @property
。以上是黑客CSS動畫狀態和播放時間的詳細內容。更多資訊請關注PHP中文網其他相關文章!