Monday, 28 December 2015

Ten Great Tech Puns

Puns and wordplay - tech has been on the receiving end ever since the evolution of the modern-day computer gave rise to innocuous everyday object names being used in computer terminology.

I can't reference all of these, but I will when able.

1. Proof that Mac Supports Windows


This may offend some Apple fanboys. Not sure I care.

2. The Network Technician's door mat


I'd buy that, and I'm not a network technician. This was taken from www.thinkgeek.com

3. HTML table


This table is actually in my living room to this day.

4. Apartment Not Found


Unfortunate apartment number, wiseass web geek neighbor.

5. I.T Support


How about some I.T support?

6. Dual-core


Apple - now with dual-core technology.

7. Twins!

Talk about a copy-paste job.

8. Refresh


Care for some... refreshments?

9. Interesting USB Drive

Because Jesus saves!

10.  Slide to Unlock

A little below the belt, this one. From www.iospop.com


Laughter is the best Mac-dicine!
T___T

Monday, 21 December 2015

Web Tutorial: A Christmas Animation (Part 4/4)

The animation's more or less there. We're going to do some tidying up.

What do most good animations have? A Replay feature! So take another look at your HTML. Fill in whatever message you like in the text_wrapper div. The txtReplay div is meant as a placeholder for your Replay button text.

What's really important here is the Replay feature. To facilitate that, let's create a reset() function in the JavaScript like so.
            function reset()
            {
                var houses=document.getElementsByClassName("house");

                for (var i=0;i<houses.length;i++)
                {
                    houses[i].style.marginTop="400px";
                }

                document.getElementById("spinleft").innerHTML="";
                document.getElementById("spinright").innerHTML="";

                document.getElementById("txtReplay").innerHTML="(please wait...)";
                setTimeout(function() {play();},4000);
            }

            function play()
            {
                snowflakes(100);
                raisehouses();
            }


This basically resets the margin-top property of all the building blocks back to 400px, then clears the spinright and spinleft divs of all snowflakes. (Santa remains untouched. I'm a lazy bastard that way.) Then the txtReplay div is filled with the words "(please wait...)" while a timer function triggers the play() function.

And the play() function, of course, begins the animation! Of course, we need to add a new line here...
            function play()
            {
                snowflakes(100);
                raisehouses();
                document.getElementById("txtReplay").innerHTML="(click to replay)";
            }


So the text changes to "(click here to replay)" once the animation starts running.

We're done here!

Check out the results. The jolly old dude ho-ho-hoing his way across the landscape of buildings and snow. Try the replay button. Does it all go back to the beginning?

Wishing you a very HO-HO-HO-ly Christmas,
T___T

Saturday, 19 December 2015

Web Tutorial: A Christmas Animation (Part 3/4)

For this next segment of the web tutorial, the jolly old man himself will make an appearance. We'll use this graphic, and show him floating across the sky. Here's the image we'll be using.

santa.png


Add this to your HTML. Here, within the main_wrapper div, we have a div with an id of santa_wrapper. Within this div there are two other divs - sleigh_wrapper and ho_wrapper.
        <div id="main_wrapper">
            <div id="spinright" class="snow_wrapper">

            </div>

            <div class="house"></div>
            <div class="house"></div>
            <div class="house"></div>
            <div class="house"></div>
            <div class="house"></div>
            <div class="house"></div>
            <div class="house"></div>
            <div class="house"></div>

            <div id="spinleft" class="snow_wrapper">
          
            </div>

            <div id="santa_wrapper">
                <div id="sleigh_wrapper">
  
                </div>  
                <div id="ho_wrapper">
                    HO
                </div>              
            </div>
        </div>


Now, let's style the divs. Add this to your CSS.
            #main_wrapper
            {
                margin-left:auto;
                margin-right:auto;
                margin-top:5%;
                margin-bottom:200px;
                width:400px;
                height:400px;
                background-color:#000044;
                position:relative;
                overflow:hidden;
            }  

            #santa_wrapper
            {
                width:250px;
                height:50px;
                position:absolute;
                z-index:0;
                margin-top:50px;
                margin-left:450px;
                border: 1px solid #FF0000;
            }

            #sleigh_wrapper
            {
                width:100px;
                height:50px;
                background-size:contain;
                background-image:url(santa.png);
                background-repeat:no-repeat;
                background-position:left top;
                position:relative;
                float:left;
                border: 1px solid #FF0000;
            }

            #ho_wrapper
            {
                position:relative;
                float:left;
                color:#000000;
                font-weight:bold;
                font-family:arial;
                width:30px;
                height:30px;
                border: 1px solid #FF0000;
            }

            .house
            {
                background-color:#000000;
                width:50px;
                height:300px;
                border:0px solid #FFFFFF;
                float:left;
                margin-top:400px;
                position:relative;
                z-index:10;
                transition:margin-top 2s;
                -webkit-transition:margin-top 2s;
            }


The margin-left property of santa_wrapper has been set to 450px and this means that Santa will be out of sight when the animation starts. sleigh_wrapper has its background set to the image I showed you at the beginning of this blogpost. And the ho_wrapper div is set to stick to the back of sleigh_wrapper with float:left.

I've also set all the border properties to these three classes to red, so you can see clearly.

Set the main_wrapper div's overflow property back to visible and you'll see how things are set up.
            #main_wrapper
            {
                margin-left:auto;
                margin-right:auto;
                margin-top:5%;
                margin-bottom:200px;
                width:400px;
                height:400px;
                background-color:#000044;
                position:relative;
                overflow:visible;
            }




Ho Ho ho

Let's wrangle the guffawing of the old man first. Add this to the CSS.
            #ho_wrapper
            {
                position:relative;
                float:left;
                color:#000000;
                font-weight:bold;
                font-family:arial;
                width:30px;
                height:30px;
            }

            .ho1
            {
                margin-top:10px;
                margin-left:20px;
                font-size:25px;
            }

            .ho2
            {
                margin-top:10px;
                margin-left:50px;
                font-size:20px;
            }

            .ho3
            {
                margin-top:10px;
                margin-left:80px;
                font-size:16px;
            }


Then modify your HTML, by styling the ho_wrapper div with the ho1 CSS class.
            <div id="santa_wrapper">
                <div id="sleigh_wrapper">
  
                </div>  
                <div id="ho_wrapper" class="ho1">
                    HO
                </div>              
            </div>


Next, modify your JavaScript by adding the hohoho() function. Then attach the hohoho() function to a timer function to kick things off.
            function raisehouses()
            {
                var houses=document.getElementsByClassName("house");

                for (var i=0;i<houses.length;i++)
                {
                    createwindows(houses[i]);
                    houses[i].style.marginTop=generaterandomno(100,200)+"px";
                }
            }

            var santatimer=setTimeout(function() {hohoho(1);},1500);

            function hohoho(varho)
            {
                var ho=document.getElementById("ho_wrapper");
                ho.className="ho" + varho;
                if (varho==4)
                {
                    santatimer=setTimeout(function() {hohoho(1);},1000);
                    ho.innerHTML="";
                }
                else
                {
                    santatimer=setTimeout(function() {hohoho(varho+1);},200);
                    ho.innerHTML="HO";
                }
            }

            function play()
            {
                snowflakes(100);
                raisehouses();
            }


The hohoho() function accepts a parameter varvalue which determines what class the ho_wrapper div is styled by. If varvalue is "1", ho_wrapper is styled by ho1, and then the function calls itself, this time with a argument of "2". And so on...

This is called a recursive function. Look it up! (https://en.wikipedia.org/wiki/Recursion_%28computer_science%29)

Long story short, your Santa should look like this now, with "HO HO HO" trailing out of the back of his sleigh.



Now let's move the sleigh. Alter your CSS class santa_wrapper with this keyframe information. This basically means that santa_wrapper starts at the position margin-left:450px, and floats across the screen to end up at position margin-left:-350px. The animation has been set at 5 seconds, and will be delayed by 2 seconds (to give the buildings at the beginning of the animation time to "spring up".)
            #santa_wrapper
            {
                width:250px;
                height:50px;
                position:absolute;
                z-index:0;
                margin-top:50px;
                margin-left:450px;
                border: 1px solid #FF0000;
                animation-name: movesanta;
                animation-duration: 5s;
                animation-delay: 2s;
                animation-iteration-count: infinite;
                animation-timing-function: linear;
                -webkit-animation-name: movesanta;
                -webkit-animation-duration: 5s;
                -webkit-animation-delay: 2s;
                -webkit-animation-iteration-count: infinite;
                -webkit-animation-timing-function: linear;
            }

            @-webkit-keyframes movesanta {
                from {margin-left:450px;}
                to {margin-left:-350px;}
            }

            @keyframes movesanta {
                from {margin-left:450px;}
                to {margin-left:-350px;}
            }


Do you see the animation clearly?



Now set the overflow property of the main_wrapper div back to hidden.
            #main_wrapper
            {
                margin-left:auto;
                margin-right:auto;
                margin-top:5%;
                margin-bottom:200px;
                width:400px;
                height:400px;
                background-color:#000044;
                position:relative;
                overflow:hidden;
            }


And reset the borders of your santa_wrapper, sleigh_wrapper and ho_wrapper divs.
            #santa_wrapper
            {
                width:250px;
                height:50px;
                position:absolute;
                z-index:0;
                margin-top:50px;
                margin-left:450px;
                border: 0px solid #FF0000;
                animation-name: movesanta;
                animation-duration: 5s;
                animation-delay: 2s;
                animation-iteration-count: infinite;
                animation-timing-function: linear;
                -webkit-animation-name: movesanta;
                -webkit-animation-duration: 5s;
                -webkit-animation-delay: 2s;
                -webkit-animation-iteration-count: infinite;
                -webkit-animation-timing-function: linear;
            }

            @-webkit-keyframes movesanta {
                from {margin-left:450px;}
                to {margin-left:-350px;}
            }

            @keyframes movesanta {
                from {margin-left:450px;}
                to {margin-left:-350px;}
            }

            #sleigh_wrapper
            {
                width:100px;
                height:50px;
                background-size:contain;
                background-image:url(santa.png);
                background-repeat:no-repeat;
                background-position:left top;
                position:relative;
                float:left;
                border: 0px solid #FF0000;
            }

            #ho_wrapper
            {
                position:relative;
                float:left;
                color:#000000;
                font-weight:bold;
                font-family:arial;
                width:30px;
                height:30px;
                border: 0px solid #FF0000;
            }


Now Santa periodically floats across the screen, laughing like a boss!

Next

The final touches.


Wednesday, 16 December 2015

Web Tutorial: A Christmas Animation (Part 2/4)

We have a snowy animated background. Cool! But what's a background without a skyline? That's right. We're going to make a skyline out of simple rectangular blocks.

First, revert your CSS for the main_wrapper and snow_wrapper divs to the previous settings. This will give you a better view of what's going on.

Now add the CSS class house.
            #main_wrapper
            {
                margin-left:auto;
                margin-right:auto;
                margin-top:5%;
                margin-bottom:200px;
                width:400px;
                height:400px;
                background-color:#000044;
                position:relative;
                overflow:visible;
            }   

            .house
            {
                background-color:#000000;
                width:50px;
                height:300px;
                border:0px solid #FFFFFF;
                float:left;
                margin-top:400px;
                position:relative;
                z-index:10;
                transition:margin-top 2s;
                -webkit-transition:margin-top 2s;
            }

            .snow_wrapper
            {
                width:600px;
                height:600px;
                position:absolute;
                z-index:10;
                margin-top:-200px;
                border:1px solid #00FFFF;
            }

Here's what the CSS does...
- background-color:#000000 makes the block black. A good color for what's essentially supposed to be a silhouette.
- width:50px, height:300px defines the dimensions of each building block.
- float:left ensures that each div with the class house, aligns neatly to the left side of main_wrapper.
- margin-top:400px pushes all the blocks down, past the height of the main_wrapper div. But since the overflow property of the main_wrapper div is set to visible, you can still see them at the moment!
- transition:margin-top 2s specifies that any change involving the margin-top property of the div will be tweened over 2 seconds.

Now that the CSS is defined, I want you to do this to your HTML. And change the body's background color to white, so you can see better.
    <body onload="play();" style="background-color:#FFFFFF;">
        <div id="main_wrapper">
            <div id="spinright" class="snow_wrapper">

            </div>

            <div id="spinleft" class="snow_wrapper">
           
            </div>

            <div class="house"></div>
            <div class="house"></div>
            <div class="house"></div>
            <div class="house"></div>
            <div class="house"></div>
            <div class="house"></div>
            <div class="house"></div>
            <div class="house"></div>
        </div>


Do you see that all the blocks are aligned like this? Looks like one solid black block, doesn't it?


Great. Now we're going to add the JavaScript to animate them. Of course, we're going to add raisehouses() function to the play() function. So as soon as the page is loaded, snowflakes() runs first, followed by raisehouses()!
            function raisehouses()
            {

            }


            function play()
            {
                snowflakes(100);
                raisehouses();
            }
</div>

This is the JavaScript.
<div class="post_box code">
            function raisehouses()
            {
                var houses=document.getElementsByClassName("house");

                for (var i=0;i<houses.length;i++)
                {
                    createwindows(houses[i]);
                    houses[i].style.marginTop=generaterandomno(100,200)+"px";
                }

            }

            function play()
            {
                snowflakes(100);
                raisehouses();
            }


Firstly, you get all elements that use the CSS class house, ie. all the black black , and put their id in an array. Next, you use a For loop to traverse the array. Each of these houses will have their margin-top property set with a random value, so that they all spring up and form a randomly distributed skyline, made of buildings with various heights.

Then the createwindows() function is run for each block. Here's the JavaScript for it...
            function createwindows(varobj)
            {
                var table="";

                table+="<table style=\"width:80%;margin-left:auto;margin-right:auto;margin-top:10px;\" cellspacing=\"5\">";
                for (var i=0;i<generaterandomno(2,8);i++)
                {
                    table+="<tr>";
                    table+="<td style=\"background-color:#"+(generaterandomno(0,2)==1?"000000":"FFFF00")+"\">&nbsp;</td>";
                    table+="<td style=\"background-color:#"+(generaterandomno(0,2)==1?"000000":"FFFF00")+"\">&nbsp;</td>";
                    table+="</tr>";                   
                }
                table+="</table>";

                varobj.innerHTML=table;
            }


            function raisehouses()
            {
                var houses=document.getElementsByClassName("house");

                for (var i=0;i<houses.length;i++)
                {
                    createwindows(houses[i]);
                    houses[i].style.marginTop=generaterandomno(100,200)+"px";
                }
            }

            function play()
            {
                snowflakes(100);
                raisehouses();
            }


The createwindows() function generates a HTML table with with 2 columns and between 2 to 8 rows, again using the generaterandomno() function. These are the "windows" of the buildings. Of course, not all windows will be lit up. So each window is given a 1-in-3 chance of not being lit up .ie, with a yellow background. You may wish to adjust the color or the random values as you see fit. That particular block's innerHTML property is then set to the HTML table.

Now that's what it does.


Set the overflow property of your main_wrapper CSS class back to hidden and the border property of the snow_wrapper CSS class back to 0px.
            #main_wrapper
            {
                margin-left:auto;
                margin-right:auto;
                margin-top:5%;
                margin-bottom:200px;
                width:400px;
                height:400px;
                background-color:#000044;
                position:relative;
                overflow:hidden;
            }  

            .house
            {
                background-color:#000000;
                width:50px;
                height:300px;
                border:0px solid #FFFFFF;
                float:left;
                margin-top:400px;
                position:relative;
                z-index:10;
                transition:margin-top 2s;
                -webkit-transition:margin-top 2s;
            }

            .snow_wrapper
            {
                width:600px;
                height:600px;
                position:absolute;
                z-index:10;
                margin-top:-200px;
                border:0px solid #00FFFF;
            }


Presto!



What's wrong with this picture?

Well, you'll notice that the snowflakes are all falling behind the buildings. This isn't wrong per se, but we can do better.

Try moving the code segment.
            <div id="spinright" class="snow_wrapper">

            </div>

            <div class="house"></div>
            <div class="house"></div>
            <div class="house"></div>
            <div class="house"></div>
            <div class="house"></div>
            <div class="house"></div>
            <div class="house"></div>
            <div class="house"></div>

            <div id="spinleft" class="snow_wrapper">
          
            </div>


Run your code again in the browser. See that some snowflakes are falling in front of the buildings, and some behind? That's because the buildings and the spinright and spinleft divs (which hold the snowflakes) have all had their z-index properties set to 10. So that being equal, the browser just renders the items according to their sequence in the HTML, ie. spinright div, building blocks, spinleft div.




Next

The next piece of the puzzle - Santa himself.


Monday, 14 December 2015

Web Tutorial: A Christmas Animation (Part 1/4)

Dear readers, Christmas approaches. And here's the Christmas edition of TeochewThunder!

For this web tutorial, we'll be making a nice Christmas animation that can be put on your website, or on an e-greeting card. There will be only one image used, a nice silhouette of Santa on his sleigh. Hold your reindeer for now, we won't need the image just yet.

This tutorial will make extensive use of the CSS3 animations and JavaScript. There's precious little HTML involved, except to bind it all together. In fact, here's the starting HTML.
<!DOCTYPE html>
<html>
    <head>
        <title>XMas 2015</title>

        <style>
            #main_wrapper
            {
                margin-left:auto;
                margin-right:auto;
                margin-top:5%;
                margin-bottom:200px;
                width:400px;
                height:400px;
                background-color:#000044;
                position:relative;
            }

            #text_wrapper
            {
                cursor:pointer;
                width:100%;
                height:200px;
                position:absolute;
                top:500px;
                text-align:center;
                font-size:24px;
                font-weight:bold;
                color:#FFAA00;
            }

            #txtReplay
            {
                font-size:0.55em;
            }
        </style>

        <script>
            function play()
            {

            }
        </script>
    </head>
    <body onload="play();" style="background-color:#000000;">
        <div id="main_wrapper">
            <div id="spinright">

            </div>

            <div id="spinleft">
          
            </div>
        </div>
        <div id="text_wrapper" onclick="reset();">
            Merry Christmas and a Happy New year! <br />
            T___T
            <div id="txtReplay">
               
            </div>
        </div>
    </body>
</html>

The body background has been set to black, to help you see clearer. This is only temporary.

Upon loading, the play() function is run. There is no apparent use for this right now, but it will become clear later.

So far there is one main div, with two divs nested within. You'll add more as the tutorial goes on, but not that much more. Most of the work is being done through CSS and JavaScript. Yes, I've mentioned
that before, but apparently I'm a terrible nag.

So you have a main_wrapper div, and two nested divs named spinright and spinleft.

The main_wrapper div is styled too, with the following properties...
- margin-left:auto, margin-right:auto centralizes the div
- margin-top:5%,margin-bottom:200px ensures that the div has a certain amount of screen space to work with.
- width:400px, height:400px sets the size of the div.
- background-color:#000044 sets the background of the div to a dark blue.
- position:relative

Let's see what we have so far!
You won't see the spinleft and spinright divs because the height and width haven't been set yet. We'll fix that with the snow_wrapper CSS class.

Now make the following changes to your HTML, and add the CSS class snow_wrapper. In the CSS, also add the specifications for spinright and spinleft.
<!DOCTYPE html>
<head>
        <title>XMas 2015</title>

        <style>
            #main_wrapper
            {
                margin-left:auto;
                margin-right:auto;
                margin-top:5%;
                margin-bottom:200px;
                width:400px;
                height:400px;
                background-color:#000044;
                position:relative;
            }

            .snow_wrapper
            {
                width:600px;
                height:600px;
                position:absolute;
                z-index:10;
                margin-top:-200px;
                border:1px solid #00FFFF;
            }


            #spinright
            {
                margin-left:-300px;
            }

            #spinleft
            {
                margin-left:100px;
            }


            #text_wrapper
            {
                cursor:pointer;
                width:100%;
                height:200px;
                position:absolute;
                top:500px;
                text-align:center;
                font-size:24px;
                font-weight:bold;
                color:#FFAA00;
            }

            #txtReplay
            {
                font-size:0.55em;
            }
        </style>

        <script>
            function play()
            {

            }
        </script>
    </head>
    <body onload="play();" style="background-color:#000000;">
        <div id="main_wrapper">
            <div id="spinright" class="snow_wrapper">

            </div>

            <div id="spinleft" class="snow_wrapper">
          
            </div>
        </div>
        <div id="text_wrapper" onclick="reset();">
            Merry Christmas and a Happy New year! <br />
            T___T
            <div id="txtReplay">
               
            </div>
        </div>
    </body>
</html>

You'll see that both the spinright and spinleft divs are now a lot larger (as the height and width has been set to 600px). position: absolute and z-index:10 ensures that they appear in front of the main_wrapper div. margin-top has been set to -200px to set their vertical position correctly. The spinright div has its margin-right property set to -300px and spinleft div has its margin-left property set to 100px. The net result is that the two squares are now overlapping, over the main_wrapper div. The border property has been set to 1px solid #00FFFF for illustration purposes. That's cyan for you non-geeks.

See the results!

The spinright and spinleft divs are meant to hold snowflakes. To that end, add the CSS class snowflake.
            .snow_wrapper
            {
                width:600px;
                height:600px;
                position:absolute;
                z-index:10;
                margin-top:-200px;
                border:1px solid #00FFFF;
            }

            .snowflake
            {
                position:absolute;
                border-radius:20px;
            }

            #spinright
            {
                margin-left:-300px;
            }

            #spinleft
            {
                margin-left:100px;
            }

Then add this JavaScript.
            function generaterandomno(varmin,varmax)
            {
                return Math.floor((Math.random() * (varmax-varmin+1)) + varmin);
            }

            function snowflakes(varno)
            {

            }


            function play()
            {

            }

The generaterandomno() function was taken from here and will help us in several places here. For one, it's going to help us fill the spinright and spinleft divs with randomly positioned snowflakes. So let's alter the snowflakes() function below.
            function snowflakes(varno)
            {
                var spinleft=document.getElementById("spinleft");
                var spinright=document.getElementById("spinright");
                var snow;
                var size;
                var i;

                for (i=0;i<=varno;i++)
                {
                    snow=document.createElement("div");
                    snow.className="snowflake";
                    size=generaterandomno(1,3);
                    snow.style.width=size+"px";
                    snow.style.height=size+"px";
                    snow.style.marginLeft=(generaterandomno(10,600))+"px";
                    snow.style.marginTop=(generaterandomno(10,600))+"px";
                    snow.style.backgroundColor="rgba(254,254,254,"+(generaterandomno(1,10)/10)+")";

                    spinleft.appendChild(snow);

                    snow=document.createElement("div");
                    snow.className="snowflake";
                    size=generaterandomno(1,3);
                    snow.style.width=size+"px";
                    snow.style.height=size+"px";
                    snow.style.marginLeft=(generaterandomno(10,600))+"px";
                    snow.style.marginTop=(generaterandomno(10,600))+"px";
                    snow.style.backgroundColor="rgba(254,254,254,"+(generaterandomno(1,10)/10)+")";

                    spinright.appendChild(snow);
                }
            }

This basically creates a node in the divs spinright and spinleft, with the CSS class snowflake which gives each snowflake that rounded appearance. Size, position and transparency are properties randomly generated by the generaterandomno() function. varno is a parameter passed in, and it determines how many snowflakes are added to each div. So if varno is x, x snowflakes will be added to the divs spinright and spinleft.

More on the appendChild method. (link)

Now add this line to the play() function. Remember that the play() function is being run upon the page being loaded, which in turn means that the snowflakes() function will be run.

            function play()
            {
                snowflakes(100);
            }


Now run your code. 100 snowflakes added to each div! Feel free to adjust the number, but I'm cool with 100.

 

Now for some spin!

The snowflakes are all well and good, but this is supposed to be an animation. With that in mind, let's make the divs rotate!

Make these changes to the CSS classes spinright and spinleft.
            #spinright
            {
                margin-left:-300px;
                animation-name: rotateclockwise;
                animation-duration: 15s;
                animation-delay: 0s;
                animation-iteration-count: infinite;
                animation-timing-function: linear;
                -webkit-animation-name: rotateclockwise;
                -webkit-animation-duration: 15s;
                -webkit-animation-delay: 0s;
                -webkit-animation-iteration-count: infinite;
                -webkit-animation-timing-function: linear;

            }

            #spinleft
            {
                margin-left:100px;
                animation-name: rotateanticlockwise;
                animation-duration: 15s;
                animation-delay: 0s;
                animation-iteration-count: infinite;
                animation-timing-function: linear;
                -webkit-animation-name: rotateanticlockwise;
                -webkit-animation-duration: 15s;
                -webkit-animation-delay: 0s;
                -webkit-animation-iteration-count: infinite;
                -webkit-animation-timing-function: linear;

            }

            @-webkit-keyframes rotateclockwise
            {
                from {-webkit-transform:rotate(0deg);}
                to {-webkit-transform:rotate(360deg);}
            }

            @keyframes rotateclockwise
            {
                from {transform:rotate(0deg);}
                to {transform:rotate(360deg);}
            }

            @-webkit-keyframes rotateanticlockwise
            {
                from {-webkit-transform:rotate(360deg);}
                to {-webkit-transform:rotate(0deg);}
            }

            @keyframes rotateanticlockwise
            {
                from {transform:rotate(360deg);}
                to {transform:rotate(0deg);}
            }


You'll see that I added keyframe specs for rotateclockwise (and its webkit equivalent for cross-broswer compatibility) which basically say to take 15 seconds to rotate 360 degrees. I use the rotateanticlockwise keyframe specification for the CSS class spinleft, only this time I set the animation-direction property to rotate the other direction.

Check out the result now! Do you see what I did there? Now it looks like there's snow blowing all over the place!

Now to clean things up, let's change the CSS class snow_wrapper...
            .snow_wrapper
            {
                width:600px;
                height:600px;
                position:absolute;
                z-index:10;
                margin-top:-200px;
                border:0px solid #00FFFF;
            }

...and add this to your main_wrapper CSS class.
            #main_wrapper
            {
                margin-left:auto;
                margin-right:auto;
                margin-top:5%;
                margin-bottom:200px;
                width:400px;
                height:400px;
                background-color:#000044;
                position:relative;
                overflow:hidden;
            }   

Now that the borders have been removed and the fat trimmed off, how does it look? Awesome, right?


Next

This is just the beginning, my young Padawan. More animation goodness awaits!