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

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.

主站蜘蛛池模板: 江阴市| 汝南县| 凤山市| 嘉义市| 剑阁县| 墨江| 渭源县| 孟州市| 凭祥市| 麻江县| 高平市| 科技| 新竹县| 神农架林区| 饶阳县| 福鼎市| 永康市| 集贤县| 策勒县| 若羌县| 铜梁县| 威宁| 龙江县| 万荣县| 内黄县| 大姚县| 库尔勒市| 鸡东县| 遂川县| 台中市| 旬邑县| 平乐县| 安仁县| 尚志市| 洛阳市| 云龙县| 美姑县| 准格尔旗| 武定县| 子长县| 临夏市|