Chapter 10 CSS Transforms, Transition and Animations

Reloading Linked Files (i.e., JavaScript, CSS external files)

Class Site Designs...

Historically Opera has been best at supporting CSS, add Opera to my home computer - looks to still be true.
CSS3 Web-site generators will often generate specific code for each browser.

Transitions Historically

transform : [ rotate | scale(x,y) | skew ]

transform-style: flat|preserve-3d|initial|inherit; (flast is default)

transform:rotate( n° )

1 transform:rotate(0deg)
2 Rotate 45° CCW (same as CW) note transforms don't affect element around them so this will overlap previous div block
3 transform:rotate(10deg); CW
4 transform:rotate(90deg); CW
5 transform:rotate(180deg); CW
6 transform:rotate(720deg); CW Rotations
7 From css3maker.com Just move transform CSS3 property after browser specific cases

transform:scale(x,y)

transform:scale(1); computed size
transform:scale(0.5); 1/2 size
transform:scale(2);
transform:scale(0.5,2); 1/2 size x double size Y
scale( 1.5, 0.5 );
scale( -1 ); flip elment upside down left to right
scale( -1, 1 ); flip elment vertical axis only
scale(-2, -1 ); double x and flip
From css3please using using transform-style: preserve-3d; and perspective: 300px;

transform:translate( x, y );

1 Book errata page 326 need transform property before translate
2 Beware of transformed elements, the original location prior translation is used for rendering
3 This is a translate(200px, 150px); but notice its original location is now blank, and it overlaps next content
4 They can overlap other page content, translate is normally used with buttons
Rollover Tilt, translate, click is down
5 Rotate up transform: translateY( -5em ); Overlap?
6 Rotate up transform: translate( 0, -5em ); reminder its translate( x, y );

transform: skew( x axis translate by x °, y axis translation y ° gives a 3D out of page translation )

1 transform: skew( 45deg, 0 );
2 transform: skew( 0, 45deg );
3 transform: skew( 25deg, 10deg );

Mutiple transformation, transform: [ rotate | translate | scale | skew ] standard space separated

1 transform: rotate(45deg) scale(2);
2 transform: skew(45deg,0deg) scale(.5) translate(400px,500px) rotate(90deg);
Hover rotate and others from cssmaker.com
transform: scale(0.8) rotate(10deg) translateX(91px); textbook stie

transform-origin: x% y%; axis of rotation default center of element

1 default origin; transform-origin: 0% 0%; transform: rotate(45deg);
2 transform-origin: left top; transform: rotate(45deg);
3 transform-origin: right bottom; transform: rotate(45deg); same as 100% 100%
4 transform-origin: 0% 100%; transform: rotate(45deg);

Transitions animation from CSS property set to nexDW Edit transitiont CSS property set

DW Window --> CSS Transition shows current transitions; clicking edit bring edit Transition

  1. Before (target rule) (#transition1)
  2. set transition property, duration, delay, easing with before rule
  3. trigger - transition on "action"
  4. #transition1: hover will have after target
    style rules

transtion : properties duration timing-function delay

Animated Properties by w3c but let DW do it, orange to blue on hover


Animations

@keyframes growAndGlow { from { background-color: yellow; }
50% { transform: scale(1.5); background-color: blue; }
to { transform: scale(3); background-color: red; }
}
.animation1 { animation-name: growAndGlow; animation-delay: 3s; animation-duration: 5s;}

will change color grow once, starting at 3seconds and ending 5 seconds later.

Creating an Animation

  1. 
      first Create @keyframes fadeIn { 
        from { opacity: 0; } 
        to { opacity: 1; }
      }
  2. Use animation-property use with selector .announcement { animation-name: fadeIn; animation-delay: 10s; animation-duration: 5s; animation-iteration-count: 2; /*can set to infinite but this can get annoying */ }

animation name duration timing-function delay iteration-count direction fill-mode

Subtle Button effect is good

 

Chapter 10 Tutorial is on pages 349-355.