Pure CSS3 Animated AT-AT Walker from Star Wars

In this article we’ll quickly walk-through the process of creating a CSS3 animation of an AT-AT Walker from The Empire Strikes Back. We’ll start off by reviewing some CSS3 properties that made this animation possible. Then, follow up with a list of the sections required to construct the AT-AT and the CSS3 code to move each section. I wont go too deep into the explanations of CSS3. There are various resources online to get you up to speed with CSS3.

Lets review some of the important CSS3 properties:

TRANSFORM: TRANSLATE(X Y) ROTATE(X)

-webkit-transform: translate(x,y) rotate(x)

These CSS3 transform properties are pretty self explanatory. Translate allows you to move an object left, right, up, down and the rotate property, well… rotates.

@-KEYFRAMES ‘ANIMATION-NAME’

@-webkit-keyframes 'bounce' {0 {top: 20px;}
40% {top: 0;}
60% {top: 20px;}
100% {top: 0}
}
#ball:hover {
-webkit-animation-name: bounce;
-webkit-animation-duration: 4s;
-webkit-animation-iteration-count: infinite;
}

The keyframes function/property allows us to define a keyframe animation over a specified amount of time. Let me describe how the keyframe property works by explaining the code above of the bouncing animation.

At 0%, the keyframes function is placing the object 20px from the top. 40% into the animation that object should move up to be 0px from the top. At 60% into the animation, the object should move back down 20px from the top. By the time the animation gets to 100% it should move back to 0px from the top again. In the second rule we apply this animated behavior to the #ball element upon hover.

When the user hovers over the link with an id of ‘#ball” it will activate the bounce function. We have specified that the animation duration should last 4 seconds. Meaning that it will take 4 seconds for the animation to run from 0% to 100%. Finally we allow the animation to run infinitely. If we wanted the ball to only bounce a couple of times and then stop we would just put a 1 or 2 in the webkit-animation-iteration property.

TRANSFORM-ORIGIN: X Y

-webkit-transform-origin: x y;

This is an extremely important property for animation. The transform origin property allows you to change the point from which animation or transformation for any given object occurs.

Figure (a – Here you see the transform origin is in its default location in the center of the arm image (red circle). If we where to rotate the arm using this transform origin point. The arm would spin around from the center. Like the blades of a helicopter.

Figure (b – We have moved the transform origin point to the top, center of the arm image. Now if we rotate the image from this transformation point it would rotate correctly like a properly hinged arm.

Lets Move On to the AT-AT, Its Sections and the CSS3 Properties That Apply to Those Sections:

THE SHELL – one png image; keyframes and animated rotation properties are applied to coincide with the movement of the legs. The shell will sway a little as each leg steps forward.

@-webkit-keyframes rotate-shell {
0% {-webkit-transform: rotate(0deg);}
20% {-webkit-transform: rotate(3deg);}
40% {-webkit-transform: rotate(0deg);}
50% {-webkit-transform: rotate(0deg);}
70% {-webkit-transform: rotate(-3deg);}
90% {-webkit-transform: rotate(0deg);}
100% {-webkit-transform: rotate(0deg);}
}
#atat #shell {
-webkit-animation-name: rotate-shell;
-webkit-animation-duration: 4s;
-webkit-animation-iteration-count: infinite;
}

THE LEG (Thigh, Knee, Shin, Foot) – The leg animation is the crux of this whole experiment. The leg is comprised of a div with 3 child divs nested within it. Thigh, Shin, Knee and foot. The foot is a child of the shin div. The shin div is a child of the thigh div. Finally the thigh div is a child of the leg div. By nesting the divs in this manner, we can mimic the functionality of a skeleton.

In addition to nesting these divs, we moved the transform origin points from the center of the leg divs to the top, center. This allow us to create hinges or bones. As the leg div steps forward, the thigh div rotates x degrees on its transform origin point, rotating the shin and foot along with it. The shin already moving along the rotation point of the thigh begins its own rotation from its own transform origin point, rotating the foot along with it. The foot moving along the rotation path of the thigh AND the shin begins its own rotation cycle. This gives the legs that robotic, hinged look.

For each leg, the animation lasts 8 seconds. Since I needed only one leg to move at a time. I split the animation into four different parts. For the first leg the animation keyframe begins at 0% and ends at 25% (2 sec), the second leg begins its animation cycle at 25% and ends at 50%, the third leg begins at 50% and ends at 75% and the fourth begins at 75% and ends at 100%. By staggering the keyframe animation like this I was able to mimic the movement from the ‘Empire Strikes Back’ movie where the AT-AT’s are only moving one leg at a time.

(I’ll provide the CSS3 code for just one of the sections. All the leg sections move using the same strategy just different rotation values and timing.)

@-webkit-keyframes shin {
0% {-webkit-transform: rotate(0deg);}
20% {-webkit-transform: rotate(0deg);}
30% {-webkit-transform: rotate(23deg);}
50% {-webkit-transform: rotate(0deg);}
100% {-webkit-transform: rotate(0deg);}
}
#atat #leg-a .leg-shin {
-webkit-animation-name: shin-a;
-webkit-animation-duration: 7s;
-webkit-animation-iteration-count: infinite;
-webkit-transform-origin: 50% 0;}

THE HEAD (neck and skull) – The animation on this is minimal. The skull and neck extend out of the shell of the at-ats body. then the skull section swivels up and down a bit.

@-webkit-keyframes rotate-head{
0%{-webkit-transform:rotate(0deg) translate(0px,0px);}
40%{-webkit-transform:rotate(10deg) translate(15px,5px);}
80%{-webkit-transform:rotate(-5deg) translate(8px,5px);}
100%{-webkit-transform:rotate(0deg) translate(0px,0px);}
}
#atat #head {
-webkit-animation-name: rotate-head;
-webkit-animation-duration: 7s;
-webkit-animation-iteration-count: infinite;
-webkit-transform-origin: 0 50%;
}

Well, that’s it. That is the basic concept to animating a diabolical war machine using only CSS3. Feel free to post a comment or question. I’ll make sure to try and post a response quickly. Take another look at the demo, dive into the code and try to build your own.

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

February 1, 2010

This entry was posted in Website Design and tagged , , , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

96 Comments

  1. Posted August 19, 2010 at 4:59 am | Permalink

    Very cool considering it was done in CSS but the problem is how long will it take for the popular browers like IE or Firefox to adapt to CSS3

  2. Nathan
    Posted September 16, 2010 at 7:14 pm | Permalink

    What people don’t seem to realize is that CSS3 is still currently in drafting, what that means is that many major browsers all have their own extensions to CSS3 until the draft is finalized.

    This animation would be possible in other browsers if it were adapted to use their CSS3 extensions.

    Notice how the CSS3 properties are prefixed with -webkit? That’s why this will only work in WebKit browsers. Other browsers don’t need to “catch up”, Gecko (Firefox) supports CSS3 transforms as well, via the -moz-transform property. Opera, via the -o-transform property. Even IE has had it’s own DXImageTransform functionality since IE 5.5.

    The fact is, this animation – in it’s current implementation – will only ever work in a WebKit browser, no matter how much CSS3 support other browsers have.

    • Luca Salvini
      Posted February 28, 2011 at 4:51 am | Permalink

      Nathan,

      I think you’re making a bit of confusion here.

      Animation (-animation) is actually available only on Webkit at the moment.
      -transform is not enough to accomplish what you see here.

      IE’s DXimage Transform functionality is not a CSS property.

      So we still all hope for other browsers to catch up.
      Meanwhile we can still use animations for the pleasure of the ones who can see it.

    • Posted April 20, 2011 at 4:46 pm | Permalink

      Firefox now has support for this in its current Aurora build, and it will be included in Firefox 5 unless major issues are found.

      See an updated version of this demo here with the required -moz prefixes added: http://paulrouget.com/e/css3animations/

      Would be great if the demo was updated to do add these too!

      Great article, btw!

  3. Posted October 21, 2010 at 5:49 pm | Permalink

    I like the custom font!

    ..but just found out that the custom font is not working on iPhone/ iPad !?

  4. Julia
    Posted October 27, 2010 at 11:08 pm | Permalink

    What I dont comprehend is how youre not even a lot more popular than you might be now. Youre just so intelligent. You know so significantly about this topic, created me consider it from so many diverse angles. Its like men and women arent interested unless it has some thing to accomplish with Lady Gaga! Your stuffs great. Continue to keep it up!

  5. Posted January 6, 2011 at 2:43 am | Permalink

    Nice. This is great. I provide hosting information however I am sure my visitors would find this extremely interesting. I like the demo alot. Again, thanks.

  6. Posted January 11, 2011 at 12:55 pm | Permalink

    Why are these properties prefixed with -webkit? How long did you take to first create these commands, and are the 40% and 60% percentages reflective of reality of how robots or even humans can manage to rotate their arms, is it something you simply made up? Lastly, why isn’t my browser compatible with CSS3? Should I use a new one such as Google Chrome or Firefox? I am sorry that I am full of questions, I am a newbie here, a Thai college freshman, i hope that I am not bothering you, if you don’t have the time to reply to basic questions, I completely understand, I will learn them soon anyhow, just got to absorb from all the classes :)

    • Rick Elliott Jr
      Posted April 25, 2011 at 5:00 pm | Permalink

      The -webkit command is to make the command associate specifically with WebKit browsers (Such as Google Chrome). The percentages are to tell the animation what to do at those certain percentages of the animation (For Example: 0% is the beginning and 100% is the end). And currently only Google Chrome will work for CSS3 animations. Firefox supports some CSS3 but not animations.

      I hope that answered all of your questions.

      –Rick Elliott Jr

  7. Posted January 12, 2011 at 5:49 am | Permalink

    will this run on friendster CSS editor and myspace? I would love to this cool robo in my friendster and myspace account, can this be added to wordpres blog too?

  8. Posted January 15, 2011 at 7:28 am | Permalink

    Yeah, My friend told me to watch this so here I am. That was awesome. The animation really good for an ipad. I really liked the font. Keep it up.

  9. Posted March 3, 2011 at 9:07 pm | Permalink

    Thought that this was pretty sweet. I wonder how the role of practices like these will play out in the next year or two…..

  10. Posted May 18, 2011 at 11:27 am | Permalink

    Ok, I have to admit that I’m pretty new to CSS3, but the demo is inspiring to get us started. Really cool animation and thankfully I have Safari to view it. :) Looking forward to more tips from your blog. Thanks!

  11. Posted May 22, 2011 at 11:46 am | Permalink

    Hi, this article is very good, is a bit confusing to your animation css3 to me a hard time but still do not understand something, is or is not allowed in the browser?
    Greetings.

  12. Posted May 31, 2011 at 7:53 am | Permalink

    very cool animation…i am sharing it on facebook and i hope my friends will also find it interesting great stuff as well…………..

  13. Posted July 19, 2011 at 2:36 pm | Permalink

    Freaking awesome demo

  14. Posted July 25, 2011 at 3:45 pm | Permalink

    Keep on writing man, this is awesome.

  15. Jack Elliot
    Posted August 9, 2011 at 1:57 am | Permalink

    Does the @-KEYFRAMES ‘ANIMATION-NAME’ demo at the top really work for anyone? I find I can’t get the elements to animate unless I use ‘-webkit-transform: translate’. Simply specifying ‘top’ just doesn’t work.

  16. Posted August 11, 2011 at 12:41 pm | Permalink

    Sweet tutorial. Are there any specific changes I’d have to make to use this withing a wordpress.org site?

  17. Posted October 26, 2011 at 3:16 pm | Permalink

    Oh man Anothony, I think you’ve done it, you’ve managed to take me back to a great memory from my childhood.

    As my boys in Pretty Rick once said, “Like a candle let me set the scene for you…”.

    I was around 12 sitting in my bedroom with my cousin locked in on the latest star wars game for N64, I don’t even remember the game’s title, but I do remember it being ridiculously hard to beat. The thing that had me stumped is that you had to go in between the Walker’s legs and for lack of better words, hog tie these mammoth creatures and then drag them to the ground. I don’t even think I’ve ever beaten it thanks to my impatient brother returning the game, but hey, maybe something for the weekend eh?

    Thanks for the memories brother,

    T.W.

  18. Posted February 1, 2012 at 9:17 pm | Permalink

    I see the AT-AT walker, but doesn´t move. Does not work or am I doing something wrong?

31 Trackbacks

  1. [...] Pure CSS3 Animated AT-AT Walker from Star Wars Via / CSS Globe [...]

  2. By Why adobe Flash needs to die - MacTalk Forums on February 3, 2010 at 7:31 am

    [...] Who needs flash when CSS3 and WebKit browsers can do the animating? It's all explained here: Pure CSS3 Animated AT-AT Walker from Star Wars | Internet Marketing Blog __________________ twitter | [...]

  3. [...] Prepare Your Troops for a Surface Attack Pure CSS3 Animated AT-AT Walker from Star Wars [...]

  4. Pure CSS3 Animated AT-AT Walker from Star Wars…

    As a huge Star Wars fan I couldn't resist not to publish this CSS3 trick….

  5. By Cuppadev on February 6, 2010 at 3:31 pm

    More CSS Animations…

    A few days ago i popped across Anthony Calzadillas “Pure CSS3 AT-AT Walker“, which is a great application of using CSS3 Transforms and Animations to create a scene of an AT-AT Walker walking along in a simulated iPad. Anthony explains in gr…

  6. [...] HTML5 and CSS3 can do some pretty neat things. For cases such as modern, dynamic navigation and simple logo animation, it will soon make much [...]

  7. By pligg.com on February 9, 2010 at 4:06 am

    Pure CSS3 Animated AT-AT Walker from Star Wars…

    In this article we’ll quickly walk-through the process of creating a CSS3 animation of an AT-AT Walker from The Empire Strikes Back. We’ll start off by reviewing some CSS3 properties that made this animation possible. Then, follow up with a list of the…

  8. [...] making of de cette animation est disponible sur le blog Optimum7.com et après étude de celui-ci, on peut se rendre compte qu’il n’y a rien de bien [...]

  9. By Animation in CSS3 « I Am Mike Young | Blog on February 11, 2010 at 4:31 pm

    [...] AT-AT animated using ONLY CSS3 code. No Flash. No other fancy plugins. The creator talks about how he did it on the Optimum 7 blog. Pretty awesome and exciting [...]

  10. [...] Animazione di un robot | TUTORIAL | [...]

  11. By CSS3 AT-AT « MentalPolyphonics on February 23, 2010 at 3:28 pm

    [...] Via Mike, check out this pure CSS3 AT-AT walker (requires a Webkit browser like Safari or Chrome), and here’s how it’s done. [...]

  12. By Internet Explorer 6: The end (its about time!) on February 25, 2010 at 5:10 pm

    [...] These programs will do some amazing things, integrated video tag that play movies, fluid css driven animation(only visible in Chrome or Safari), among others. However to take advantage of the future of the [...]

  13. [...] business. Every time I hear a pro-apple or pro-Flash argument now, especially retarded shit like this; THAT is what makes me worried about the web as a [...]

  14. [...] Pure CSS3 Animated AT-AT Walker from Star Wars In this article we’ll quickly walk-through the process of creating a CSS3 animation of an AT-AT Walker from The Empire Strikes Back. We’ll start off by reviewing some CSS3 properties that made this animation possible. Then, follow up with a list of the sections required to construct the AT-AT and the CSS3 code to move each section. I wont go too deep into the explanations of CSS3. There are various resources online to get you up to speed with CSS3. [...]

  15. [...] Star Wars Walker [...]

  16. [...] style of the buttons with CSS3.CSS3 SpotlightTurn on the light! Works with Webkit & Firefox.Pure CSS3 Animated AT-AT Walker from Star Wars In this article we’ll quickly walk-through the process of creating a CSS3 animation of an [...]

  17. [...] Pure CSS3 Animated AT-AT Walker from Star Wars In this article you;kk walk-through the process of creating a CSS3 animation of an AT-AT Walker from The Empire Strikes Back. The author starts off by reviewing some CSS3 properties that made this animation possible. Then, he follows up with a list of the sections required to construct the AT-AT and the CSS3 code to move each section. [...]

  18. [...] of the buttons with CSS3.”CSS3 SpotlightTurn on the light! Works with Webkit & Firefox.Pure CSS3 Animated AT-AT Walker from Star Wars In this article you;kk walk-through the process of creating a CSS3 animation of an AT-AT Walker from [...]

  19. [...] Pure CSS3 Animated AT-AT Walker from Star Wars [...]

  20. By Future of the Web 20100620 « Paradox on June 20, 2010 at 2:53 pm

    [...] up some CSS animation stuff. Star Wars AT-AT Walker using only CSS animations. There’s also a blog post that explains how it was [...]

  21. By Giới thiệu CSS3 | vnwordpress on June 20, 2010 at 11:21 pm

    [...] with CSS3 CSS3 Spotlight Hiệu ứng bật sáng đèn! Chỉ chạy với Webkit và Firefox. Pure CSS3 Animated AT-AT Walker from Star Wars Pure CSS Icons Create a Content Slider Using Pure CSS Sexy Tooltips with Just CSS Creating a [...]

  22. By Giới thiệu CSS3 | vnwordpress on June 21, 2010 at 12:14 am

    [...] Pure CSS3 Animated AT-AT Walker from Star Wars [...]

  23. [...] Pure CSS3 Animated AT-AT Walker from Star Wars In this article you;kk walk-through the process of creating a CSS3 animation of an AT-AT Walker from The Empire Strikes Back. The author starts off by reviewing some CSS3 properties that made this animation possible. Then, he follows up with a list of the sections required to construct the AT-AT and the CSS3 code to move each section. [...]

  24. [...] Pure CSS3 Animated AT-AT Walker from Star Wars In this article you;kk walk-through the process of creating a CSS3 animation of an AT-AT Walker from The Empire Strikes Back. The author starts off by reviewing some CSS3 properties that made this animation possible. Then, he follows up with a list of the sections required to construct the AT-AT and the CSS3 code to move each section. [...]

  25. By Giới thiệu CSS3 | VNWordPress.com on June 26, 2010 at 12:47 am

    [...] Pure CSS3 Animated AT-AT Walker from Star Wars [...]

  26. By 64 CSS3 Tutorials & Techniques | Digital Pizza on July 1, 2010 at 10:16 am

    [...] Pure CSS3 Animated AT-AT Walker from Star Wars In this article you;kk walk-through the process of creating a CSS3 animation of an AT-AT Walker from The Empire Strikes Back. The author starts off by reviewing some CSS3 properties that made this animation possible. Then, he follows up with a list of the sections required to construct the AT-AT and the CSS3 code to move each section. [...]

  27. By Wszystko o HTML5 i CSS3 | Blog Staircase.pl on July 19, 2010 at 5:35 pm

    [...] Pure CSS3 Animated AT-AT Walker from Star Wars In this article we’ll quickly walk-through the process of creating a CSS3 animation of an AT-AT Walker from The Empire Strikes Back. We’ll start off by reviewing some CSS3 properties that made this animation possible. Then, follow up with a list of the sections required to construct the AT-AT and the CSS3 code to move each section. I wont go too deep into the explanations of CSS3. There are various resources online to get you up to speed with CSS3. [...]

  28. [...] Pure CSS3 animation AT-AT Walker de Star Wars Dans cet article vous; kk de plain-pied dans le processus de création d’une animation CSS3 d’un AT-AT Walker de The Empire Strikes Back. L’auteur commence par examiner certaines propriétés CSS3 qui a rendu possible cette animation. Puis, il suit avec une liste des articles nécessaires pour construire l’AT-AT et le code de CSS3 pour déplacer chaque section. [...]

  29. [...] In this tutorial, you’ll quickly walk-through the process of creating a CSS3 animation of an AT-AT Walker from The Empire Strikes Back. Visit Site [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  •  

About Optimum7

Optimum7 is an Internet Marketing Company based in Morristown, NJ with offices in Miami, FL. Our primary focus is helping small to medium sized businesses achieve online marketing success. Click to Contact Us



Optimum7 - Best Internet Marketing Company
On Mark Bassil stated: "Optimum7 brought us to the first page for dozens of our most important keywords.
They didn’t stop there as they have significantly increased the conversion rate of our website. Their staff is clearly skilled and their follow through is unmatched.
Definitely one of the best internet marketing company."