官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 德兴市| 临汾市| 琼海市| 资源县| 怀柔区| 南和县| 峨山| 广汉市| 万全县| 赤壁市| 武邑县| 泸州市| 雷波县| 遂川县| 册亨县| 图片| 濮阳县| 乡宁县| 霍山县| 红安县| 望谟县| 尼木县| 紫阳县| 阳谷县| 三台县| 民县| 乐安县| 阿拉善盟| 辽宁省| 林周县| 乐安县| 长子县| 阿坝县| 阿拉善右旗| 叙永县| 临汾市| 黄平县| 海原县| 望都县| 胶州市| 广州市|