Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Intro to CSS Animations

Intro to CSS Animations

Here's a workshop I did on the basics of CSS animations. All you need is very minimal knowledge of HTML/CSS and the latest version of Google Chrome to follow along!

Download the PowerPoint file here (complete with GIFs!): http://cl.ly/c6Ir/Intro%20to%20CSS%20Animations.pptx

## Links in this presentation:

- How the properties will animate: http://codepen.io/LabLayers/pen/MwzgNB
- Full list: http://easings.net/
- Transitions followalong, Start here: http://tiny.cc/csstransitions
- Transitions followalong, End result: http://tiny.cc/csstransitions2
- Keyframes followalong, Start here: http://tiny.cc/csskeyframes
- Keyframes followalong, End result: http://tiny.cc/csskeyframes2
- Cool examples:
- http://codepen.io/bennettfeely/pen/ErFGv
- http://cssdeck.com/labs/felix-the-magic-bag-animation
- http://www.species-in-pieces.com/
- http://bennettfeely.com/csscreatures/
- http://www.sanrio.com/timeline
- Where I Use CSS Animations:
- http://brainitch.com/ers/
- http://booksmart.it/
- https://everfreenw.com/archive/2015/everfree-northwest-2015/index.html
- https://chrome.google.com/webstore/detail/harlem-shake-the-web/ldejkceiibdbkgjfiagpjhjdadgkelib?hl=en
- Advice for Beginners: https://www.youtube.com/watch?v=E1oZhEIrer4

## Presented at:

- Leangap Boston 7/26
- Wine & Code Philly 7/27
- Princeton University 7/29

Inky Collective

July 27, 2015
Tweet

More Decks by Inky Collective

Other Decks in Design

Transcript

  1. What is an animation? •A change from one style to

    another. • Properties • Transitions • Keyframes
  2. Transition •How the properties will animate • http://codepen.io/LabLayers/pen/MwzgNB •Full list:

    • http://easings.net/ •Why is this important? • Cars • Tennis balls
  3. Keyframes •Steps of attributes (and sometime transitions) • At 0%,

    move down • At 25%, move right • At 50%, move up • At 75%, move left
  4. Keyframes •Steps of attributes (and sometime transitions) • At 0%,

    move down and turn green • At 25%, move right and turn blue • At 50%, move up and turn purple • At 75%, move left and turn red
  5. What is an animation? •A change from one style to

    another. • Properties • Attributes of an element being changed • Transitions • How the properties will animate • Keyframes • Steps of attributes (and sometime transitions)
  6. Animating Elements in CSS •It’s not that hard (really!) •

    Properties • Attributes of an element being changed • Transitions • How the properties will animate • Keyframes • Steps of attributes
  7. Translation into CSS •It’s not that hard (really!) • Properties

    • Standard CSS properties like color: red • Transitions • transition: all 500ms linear; • Keyframes & Animations • @keyframes myAnimation { } • animation: myAnimation;
  8. CSS Transition Syntax transition: color 200ms linear 500ms; transition-property: color;

    transition-duration: 200s; (transition-timing-function: linear;) (transition-delay: 500ms;)
  9. CSS Transitions •It’s simple. .button { background: purple; color: white;

    } .button:hover { transition: 300ms all ease; background: white; color: purple; }
  10. CodePen Follow-Along • Start here: • http://tiny.cc/csstransitions • End result:

    • http://tiny.cc/csstransitions2 • Click the icon in the bottom right hand corner to toggle display mode
  11. CSS Keyframe Syntax .circle { animation: my-animation 5s; } @keyframes

    my-animation { 0% {background: red;} 50% {background: blue;} 100% {background: green;} }
  12. CSS Animation Syntax animation: my-animation 5s linear 0s infinite alternate

    running; animation-name: my-animation; animation-duration: 5s; (animation-timing-function: linear;) (animation-delay: 0s;) (animation-iteration-count: infinite;) (animation-direction: alternate;) (animation-play-state: running;)
  13. Chrome Developer Tools • Great for debugging Javascript & CSS

    • Right an element with an animation and select Inspect Element • On the right Styles pane, you can slow all animations or change the curve
  14. Where I Use CSS Animations • http://brainitch.com/ers/ • http://booksmart.it/ •

    https://everfreenw.com/archive/2015/everfree-northwest- 2015/index.html • https://chrome.google.com/webstore/detail/harlem-shake- the-web/ldejkceiibdbkgjfiagpjhjdadgkelib?hl=en Advice for Beginners • https://www.youtube.com/watch?v=E1oZhEIrer4