Web Animation

Dustin Tauer

dustin@easelsolutions.com

@dtauer

 

https://github.com/dtauer/hdc2015

Topics

  • A little history
  • CSS Transitions
  • CSS Animations
  • JavaScript Animations
  • Greensock JS Library

Lots and lots of resources

History

  • The Animated GIF
  • Flash
  • JavaScript
  • jQuery
  • Other JS Libraries
  • CSS3/JavaScript

Design Tools

The Best Way?

CSS & JavaScript

CodePen

https://codepen.io

CSS Transitions

#some-button{
    width: 100px;
    height: 80px;

    transition: width 1s;

}

#some-button:hover{
    width: 120px;
}

CSS Animations

h1 {
  animation-duration: 3s;
  animation-name: slidein;
}

@keyframes slidein {
  from {
    margin-left: 100%;
    width: 300%; 
  }

  to {
    margin-left: 0%;
    width: 100%;
  }
}
h1 {
  animation-duration: 3s;
  animation-name: slidein;
}

@keyframes slidein {
  0% {
    margin-left: 100%;
    width: 300%; 
  }

  100% {
    margin-left: 0%;
    width: 100%;
  }
}

JavaScript Animations

setTimeout() - NO!

function animate() {
    
    // Animation code goes e
    if(keepAnimating){
        setTimeout(animate, 100); //100 ms
    }
    else{
        //You're done!
    }
}
animate();

requestAnimationFrame

function animate() {
    
    // Animation code goes e
    if(keepAnimating){
        requestAnimationFrame(animate);
    }
    else{
        //You're done!
    }
}
animate();

Greensock

https://greensock.com

The Cheat Sheet

https://ihatetomatoes.net/greensock-cheat-sheet/

Thanks!

dustin@easelsolutions.com

@dtauer

https://developer.mozilla.org/en-US/docs/Web/CSS/transition

https://developer.mozilla.org/en-US/docs/Web/CSS/animation

https://greensock.com

https://twitter.com/vlh

https://twitter.com/rachelnabors

https://codepen.io

HDC 2015: Web Animation

By Dustin Tauer

HDC 2015: Web Animation

  • 935