- HTML5 Game Development by Example:Beginner's Guide(Second Edition)
- Makzan
- 138字
- 2021-07-16 14:09:59
Moving game objects with CSS3 transition
We had a glimpse of the CSS3 transition and transformation modules in Chapter 1, Introducing HTML5 Games, when we were overviewing the new CSS3 features. We often want to animate the game objects by easing the properties. Transition is the CSS property designed for this purpose. Suppose that we have a playing card on the web page and want to move it to another position in five seconds. We would have to use JavaScript to set up a timer and write our own function to change the position every few milliseconds. By using the transition
property, we just need to specify the start and end styles and the duration. The browser optimizes the output and does all the easing and in-between animations.
Let's take a look at some examples to understand this.
- Instant Testing with CasperJS
- 計算思維與算法入門
- MongoDB for Java Developers
- Windows Presentation Foundation Development Cookbook
- Unity Shader入門精要
- TradeStation交易應用實踐:量化方法構建贏家策略(原書第2版)
- Spring Boot Cookbook
- Natural Language Processing with Java and LingPipe Cookbook
- 愛上micro:bit
- Webpack實戰:入門、進階與調優(第2版)
- SQL Server 2008中文版項目教程(第3版)
- TypeScript 2.x By Example
- 青少年學Python(第2冊)
- 你必須知道的.NET(第2版)
- jMonkeyEngine 3.0 Beginner’s Guide