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

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.

主站蜘蛛池模板: 民勤县| 于都县| 德惠市| 龙泉市| 栾川县| 宁陵县| 海门市| 通化县| 保定市| 乌鲁木齐县| 和林格尔县| 梅州市| 义乌市| 汪清县| 英超| 谢通门县| 深水埗区| 嵊泗县| 施秉县| 静乐县| 宜阳县| 宁乡县| 红桥区| 阳春市| 阿合奇县| 屯昌县| 碌曲县| 潍坊市| 大丰市| 咸阳市| 林口县| 南江县| 富川| 太康县| 若尔盖县| 津南区| 彩票| 交口县| 涡阳县| 阿巴嘎旗| SHOW|