CSS3 Transition Game Tutorial
โœ‚๐Ÿƒ๐Ÿพโ€โ™€๏ธ๐Ÿƒ๐Ÿผโ€โ™‚๏ธ
๐Ÿ“–

CSS3 Transition Game Tutorial

CSS3 Transition Game Tutorial

Yesterdayโ€™s CSS3 Transition Primer Tutorial started us thinking about CSS3 (Cascading Style Sheet) specification โ€œTransitionsโ€, and there, we intimated that they could be used to serve up to the web application user simple animation functionality. Today, we go a bit further down that road exporing a few more ideas in this line of work, along the way using โ€œtransitionsโ€ in a simple spider game as below โ€ฆ

Added into the โ€œtransitionsโ€ usage, building on yesterday, are the concepts (all available to read further on here, thanks) โ€ฆ

  • multiple โ€œconceptโ€ transitions
  • transition-timing-function modes of use
  • transition (CSS styling) definition separated out into its 3 constituent parts โ€ฆ
    1. transition-property
    2. transition-delay
    3. transition-duration

    โ€ฆ as per โ€ฆ


    <style>

    .cdiv {

    width: 300px;

    height: 200px;

    background: red;

    -webkit-transition-delay: 3s;

    transition-delay: 3s;

    -webkit-transition-property: height, width; /* Safari */

    transition-property: height, width;

    -webkit-transition-duration: 4s, 22s; /* Safari */

    transition-duration: 4s, 22s;

    }



    .cdiv:hover {

    width: 600px;

    height: 400px;

    }

    </style>

The game today recalls the recent CSS3 Background Size Contain and Cover Primer Tutorial use of the CSS background-size contain and cover attribute values that we harness to (lamely, admittedly) make (just one of our) spiders rear up, and mildly scare our web application game users (perhaps a few of which are rolling on the floor in apopleptic laughter).

The HTML and CSS and Javascript liveโœ‚runโ€˜s css3_transitionsโšซhtm HTML and CSS and Javascript source code, changed thisway.



Previous relevant CSS3 Transition Primer Tutorial is shown below.

CSS3 Transition Primer Tutorial

CSS3 Transition Primer Tutorial

The CSS3 (Cascading Style Sheet) specification introduced โ€œTransitionsโ€ to CSS styling of web pages. A CSS3 โ€œtransitionโ€ โ€ฆ

CSS3 transitions allows you to change property values smoothly (from one value to another), over a given duration.

Today, we use the CSS :hover selector as the basis for transitions in our liveโœ‚runโ€˜s css3_transitionsโšซhtml HTML and CSS source code.

As you might surmise using this web application, CSS3 โ€œTransitionsโ€ can act like simple animations.

Stop Press

The CSS :hover selector is not a โ€œgood fitโ€ (euphemism for โ€œit doesnโ€™t work, Bud!โ€) on mobile platforms. Looking around the โ€œnetโ€ got to this great link, thanks, which suggested adding onlick=โ€โ€ on all relevant :hover selector HTML elements, to allow for (and it only really makes sense when the real onclick event meaning is not needed) the onclick event to be simulating the onmouseover event, for those mobile platforms missing the real onmouseover event.

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

This entry was posted in Animation, eLearning, Event-Driven Programming, Tutorials and tagged , , , , , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *