lesson 17

40
Front-End Web Development Lesson 17 Animation

Upload: babong

Post on 19-Jan-2015

60 views

Category:

Technology


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Lesson 17

Front-EndWeb Development

Lesson 17Animation

Page 2: Lesson 17

Agenda

● Review● CSS3 Transitions● CSS3 Animations● Animate.css● Lab - Egg Drop Game

Page 3: Lesson 17

Review

Application Form

To Do List

Page 4: Lesson 17

CSS3 Transitions

With CSS3, we can add an effect when changing from one style to another …

● without using Flash animations● without using JavaScript

Page 5: Lesson 17

CSS3 Transitions

CSS3 transitions are effects that let an element gradually change from one style to another.

Page 6: Lesson 17

CSS3 Transitions

Must specify two things:

● the CSS property you want to add an effect to

● the duration of the effect

Page 7: Lesson 17

CSS3 Transitions

Note: If duration is not specified, the transition will have no effect.

Why? The default value is 0.

Page 8: Lesson 17

CSS3 Transitions

properties● transition● transition-delay● transition-duration● transition-property● transition-timing-function

Page 9: Lesson 17

CSS3 Transitions

properties● transition -- a shorthand property for

setting the four transition properties into a single property

Page 10: Lesson 17

CSS3 Transitions

properties● transition-delay -- specifies when the

transition effect will start

Page 11: Lesson 17

CSS3 Transitions

properties● transition-duration -- specifies how

many seconds or milliseconds a transition effect takes to complete

Page 12: Lesson 17

CSS3 Transitions

properties● transition-property -- specifies the name

of the CSS property the transition effect is for

Page 13: Lesson 17

CSS3 Transitions

properties● transition-timing-function -- specifies

the speed curve of the transition effect

Page 15: Lesson 17

CSS3 Transitions

Example:

transition_1.html

Page 16: Lesson 17

CSS3 Transitions

Example: Making Multiple Changes

To add transition effects for more than one CSS property, separate the properties with a comma.

transition_2.html

Page 17: Lesson 17

CSS3 Transitions

Example: Using Individual Properties

transition_3a.html

Example: Combining Individual Properties

transition_3b.html

Page 18: Lesson 17

CSS3 Animations

With CSS3, we can create animations which can replace …

● Flash animations● animated images● JavaScripts

... in existing web pages.

Page 19: Lesson 17

CSS3 Animations

An animation lets an element gradually change from one style to another.You can change as many properties you want, as many times you want.

Page 20: Lesson 17

CSS3 Animations

You can specify when the change will happen in percent, or you can use the keywords "from" and "to" (which represents 0% and 100%).

● 0% represents the start of the animation● 100% is when the animation is complete

Page 21: Lesson 17

CSS3 Animations

When an animation is created in the @keyframe rule, you must bind it to a selector, otherwise the animation will have no effect.

Page 22: Lesson 17

CSS3 Animations

Bind the animation to a selector (element) by specifying at least these two properties:

● the name of the animation● the duration of the animation

Page 23: Lesson 17

CSS3 Animations

properties● @keyframes● animation● animation-delay● animation-direction● animation-duration

Page 24: Lesson 17

CSS3 Animations

properties● @keyframes -- controls the intermediate

steps in a CSS animation sequence by establishing keyframes (or waypoints) along the animation sequence

Page 25: Lesson 17

CSS3 Animations

properties● animation -- a shorthand property for

setting all the animation properties, except ○ animation-play-state○ animation-fill-mode

Page 26: Lesson 17

CSS3 Animations

properties● animation-delay -- specifies when the

animation will start

Page 27: Lesson 17

CSS3 Animations

properties● animation-direction -- specifies whether

or not the animation should play in reverse on alternate cycles

Page 28: Lesson 17

CSS3 Animations

properties● animation-duration -- specifies how

many seconds or milliseconds an animation takes to complete one cycle

Page 29: Lesson 17

CSS3 Animations

more properties● animation-fill-mode● animation-iteration-count● animation-name● animation-play-state● animation-timing-function

Page 30: Lesson 17

CSS3 Animations

more properties● animation-fill-mode -- specifies what

styles will apply for the element when the animation is not playing ..

○ when it is finished, or○ when it has a "delay"

Page 31: Lesson 17

CSS3 Animations

more properties● animation-iteration-count -- specifies

the number of times an animation should be played

Page 32: Lesson 17

CSS3 Animations

more properties● animation-name -- specifies the name of

the @keyframes animation

Page 33: Lesson 17

CSS3 Animations

more properties● animation-play-state -- specifies whether

the animation is running or paused

Page 34: Lesson 17

CSS3 Animations

more properties● animation-timing-function -- specifies

the speed curve of the animation

Page 35: Lesson 17

CSS3 Animations

Example:

animation_1.html

Page 36: Lesson 17

CSS3 Animations

Example: Change the background color when the animation is 25%, and 50%, and again when the animation is 100% complete.

animation_2.html

Page 37: Lesson 17

CSS3 Animations

Example: Change the background color and the position when the animation is 25%, 50%, 75%, and again when the animation is 100% complete:

animation_3.html

Page 38: Lesson 17

CSS3 Animations

Example: Using seven animation properties

animation_4a.htmlanimation_4b.html

Page 40: Lesson 17

Lab

Egg Drop Game

● work in teams of two