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

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.

主站蜘蛛池模板: 湛江市| 通渭县| 金溪县| 榆社县| 黎川县| 海安县| 杨浦区| 肇东市| 虎林市| 木里| 洛扎县| 洱源县| 津市市| 连江县| 镇赉县| 临夏市| 垦利县| 沂源县| 子长县| 和龙市| 防城港市| 长海县| 拉萨市| 淳安县| 花莲县| 栾川县| 武安市| 龙门县| 电白县| 博客| 遂昌县| 永福县| 宜君县| 吉木萨尔县| 兴安县| 拜城县| 基隆市| 托克逊县| 静乐县| 东阿县| 文登市|