SlideShare a Scribd company logo
1 of 11
Revolver
Animating with HTML5 + CSS3
Web Design Track -
Intermediate Level
Assumes student has completed DASH projects 1 and 2.
Provide a zip file download that contains:
Final project looks like this !
“Unzip” the project folder by double-clicking on it.
Check out what’s inside:
Look inside the images folder
Open revolver.html in Brackets (don’t worry, it’s supposed to be blank!)
Let’s start by giving revolver.html a basic HTML structure:
<!DOCTYPE html>
<html>
<head>
<title>Revolver</title>
</head>
<body>
<div id="main">
</div>
</body>
</html>
Inside the <head>, add a <style> tag and set the body background:
<style>
body {
background: url(“images/space.jpg”);
background-size: cover;
}
</style>
Turn on Live Preview →
The background should fill the whole browser:
Now let’s add the sun.
Inside the #main <div>, add an <img> tag with a class and a source:
<img class=“sun” src=“images/sun.gif”>
Then, add a second <img> tag to make the planet appear too.
Live Preview →
Now let’s go back into <style> and add some CSS to center the #main
<style>
body {
background: url(“images/space.jpg”);
background-size: cover;
}
#main {
margin: 0 auto;
width: 800px;
position: relative;
}
</style>
Check out Live Preview →
Now let’s style the planet class
<style>
body {
background: url(“images/space.jpg”);
background-size: cover;
}
#main {
margin: 0 auto;
width: 800px;
position: relative;
}
.planet {
width: 70px; /* shrink (or grow) the
planet */
position: absolute;
left: 315px; /* tell it how far to move
over from the left */
top: 350px; /* tell it how far to move
down from the top */
Next, style .sun so it has the same position as .planet
<style>
body {
background: url(“images/space.jpg”);
background-size: cover;
}
#main {
margin: 0 auto;
width: 800px;
position: relative;
}
.planet {
width: 70px; /* shrinks the planet */
position: absolute;
left: 315px; /* tells it how far to
move over from the left */
top: 350px; /* tells it how far to
move down from the top */
}
.sun {
position: ???;
left: ???;
top: ???;
Now we need to add the transform property and animation code to the
.planet class
.planet {
width: 70px;
position: absolute;
left: 315px;
top: 350px;
transform: rotate(45deg) translateX(250px) rotate(-45deg);
/* This is the vendor prefix code. It sets the animation type, speed,
speed curve, and how many times it should run */
-webkit-animation: myOrbit 6s linear infinite; /* Chrome, Safari 5 */
-moz-animation: myOrbit 6s linear infinite; /* Firefox 5-15 */
-o-animation: myOrbit 6s linear infinite; /* Opera 12+ */
animation: myOrbit 6s linear infinite; /* Chrome, Firefox 16+, IE 10+,
Safari 5 */
}
Last thing is to add @keyframes right before </style>
(not inside .planet !)
/* This is @keyframes. This code controls what the animation looks like */
@-webkit-keyframes myOrbit {
from { -webkit-transform: rotate(0deg) translateX(250px) rotate(0deg); }
to { -webkit-transform: rotate(360deg) translateX(250px) rotate(-360deg); }
}
@-moz-keyframes myOrbit {
from { -moz-transform: rotate(0deg) translateX(250px) rotate(0deg); }
to { -moz-transform: rotate(360deg) translateX(250px) rotate(-360deg); }
}
@-o-keyframes myOrbit {
from { -o-transform: rotate(0deg) translateX(250px) rotate(0deg); }
to { -o-transform: rotate(360deg) translateX(250px) rotate(-360deg); }
}
@keyframes myOrbit {
from { transform: rotate(0deg) translateX(250px) rotate(0deg); }
to { transform: rotate(360deg) translateX(250px) rotate(-360deg); }
}

More Related Content

What's hot

Performance Tips In Rails Development
Performance Tips In Rails DevelopmentPerformance Tips In Rails Development
Performance Tips In Rails Development
qtlove
 
AngularJS for Legacy Apps
AngularJS for Legacy AppsAngularJS for Legacy Apps
AngularJS for Legacy Apps
Peter Drinnan
 

What's hot (20)

AngularJS Toronto: Ng babel+webpack
AngularJS Toronto: Ng babel+webpackAngularJS Toronto: Ng babel+webpack
AngularJS Toronto: Ng babel+webpack
 
Deploying Your Favorite Web App To AWS Lambda with Apex up
Deploying Your Favorite Web App To AWS Lambda with Apex upDeploying Your Favorite Web App To AWS Lambda with Apex up
Deploying Your Favorite Web App To AWS Lambda with Apex up
 
Don't Over-React - just use Vue!
Don't Over-React - just use Vue!Don't Over-React - just use Vue!
Don't Over-React - just use Vue!
 
AWS Lambda with ClaudiaJS
AWS Lambda with ClaudiaJSAWS Lambda with ClaudiaJS
AWS Lambda with ClaudiaJS
 
Jekyll demo - Refresh Hilo
Jekyll demo - Refresh HiloJekyll demo - Refresh Hilo
Jekyll demo - Refresh Hilo
 
Building a PWA - For Everyone Who Is Scared To
Building a PWA - For Everyone Who Is Scared ToBuilding a PWA - For Everyone Who Is Scared To
Building a PWA - For Everyone Who Is Scared To
 
Machine Learning for Web Developers
Machine Learning for Web DevelopersMachine Learning for Web Developers
Machine Learning for Web Developers
 
Performance Tips In Rails Development
Performance Tips In Rails DevelopmentPerformance Tips In Rails Development
Performance Tips In Rails Development
 
Mini Curso de Django
Mini Curso de DjangoMini Curso de Django
Mini Curso de Django
 
Mtl LT
Mtl LTMtl LT
Mtl LT
 
Writing your Third Plugin
Writing your Third PluginWriting your Third Plugin
Writing your Third Plugin
 
Angularjs - lazy loading techniques
Angularjs - lazy loading techniques Angularjs - lazy loading techniques
Angularjs - lazy loading techniques
 
Javascript Memory leaks and Performance & Angular
Javascript Memory leaks and Performance & AngularJavascript Memory leaks and Performance & Angular
Javascript Memory leaks and Performance & Angular
 
AngularJS for Legacy Apps
AngularJS for Legacy AppsAngularJS for Legacy Apps
AngularJS for Legacy Apps
 
Untangling spring week7
Untangling spring week7Untangling spring week7
Untangling spring week7
 
AngularJS performance & production tips
AngularJS performance & production tipsAngularJS performance & production tips
AngularJS performance & production tips
 
Gigigo Rails Workshop
Gigigo Rails WorkshopGigigo Rails Workshop
Gigigo Rails Workshop
 
Why NodeJS
Why NodeJSWhy NodeJS
Why NodeJS
 
Behavior Driven UI Automation (Agile Testing Days 2017, Potsdam)
Behavior Driven UI Automation (Agile Testing Days 2017, Potsdam)Behavior Driven UI Automation (Agile Testing Days 2017, Potsdam)
Behavior Driven UI Automation (Agile Testing Days 2017, Potsdam)
 
Tek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJSTek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJS
 

Viewers also liked

Itepalcingo concepciones de_aprendizaje
Itepalcingo concepciones de_aprendizajeItepalcingo concepciones de_aprendizaje
Itepalcingo concepciones de_aprendizaje
Ivontv
 
4eso 02-paula sarria- pres-socjo
4eso 02-paula sarria- pres-socjo4eso 02-paula sarria- pres-socjo
4eso 02-paula sarria- pres-socjo
paula-sarria
 

Viewers also liked (13)

Itepalcingo concepciones de_aprendizaje
Itepalcingo concepciones de_aprendizajeItepalcingo concepciones de_aprendizaje
Itepalcingo concepciones de_aprendizaje
 
Pakistan
PakistanPakistan
Pakistan
 
PREGUNTAS DE MOTOS
PREGUNTAS DE MOTOSPREGUNTAS DE MOTOS
PREGUNTAS DE MOTOS
 
Reglamento
ReglamentoReglamento
Reglamento
 
Осень в ДШО "Маленькая страна"
Осень в ДШО "Маленькая страна"Осень в ДШО "Маленькая страна"
Осень в ДШО "Маленькая страна"
 
деловая программа
деловая программаделовая программа
деловая программа
 
Content Analytics for Media Agencies
Content Analytics for Media AgenciesContent Analytics for Media Agencies
Content Analytics for Media Agencies
 
4eso 02-paula sarria- pres-socjo
4eso 02-paula sarria- pres-socjo4eso 02-paula sarria- pres-socjo
4eso 02-paula sarria- pres-socjo
 
Breaking down-roe-using-the-dupont-formula
Breaking down-roe-using-the-dupont-formulaBreaking down-roe-using-the-dupont-formula
Breaking down-roe-using-the-dupont-formula
 
Proyectos Emprendedores: Emprendimiento Deportivo
Proyectos Emprendedores: Emprendimiento DeportivoProyectos Emprendedores: Emprendimiento Deportivo
Proyectos Emprendedores: Emprendimiento Deportivo
 
HOW TO BUILD YOUR PERSONAL BRAND
HOW TO BUILD YOUR PERSONAL BRANDHOW TO BUILD YOUR PERSONAL BRAND
HOW TO BUILD YOUR PERSONAL BRAND
 
Aula 02 programação_c_alunos
Aula 02  programação_c_alunosAula 02  programação_c_alunos
Aula 02 programação_c_alunos
 
Presentacion Tecgvial
Presentacion Tecgvial Presentacion Tecgvial
Presentacion Tecgvial
 

Similar to Revolver

How to create a basic template
How to create a basic templateHow to create a basic template
How to create a basic template
vathur
 
ARTDM 170, Week 3: Rollovers
ARTDM 170, Week 3: RolloversARTDM 170, Week 3: Rollovers
ARTDM 170, Week 3: Rollovers
Gilbert Guerrero
 
ARTDM 170, Week 3: Rollovers
ARTDM 170, Week 3: RolloversARTDM 170, Week 3: Rollovers
ARTDM 170, Week 3: Rollovers
Gilbert Guerrero
 

Similar to Revolver (20)

How to create a basic template
How to create a basic templateHow to create a basic template
How to create a basic template
 
Make Your Animations Perform Well - JS Conf Budapest 2017
Make Your Animations Perform Well - JS Conf Budapest 2017 Make Your Animations Perform Well - JS Conf Budapest 2017
Make Your Animations Perform Well - JS Conf Budapest 2017
 
Intro to HTML5
Intro to HTML5Intro to HTML5
Intro to HTML5
 
Presentation html5 css3 by thibaut
Presentation html5 css3 by thibautPresentation html5 css3 by thibaut
Presentation html5 css3 by thibaut
 
Css3
Css3Css3
Css3
 
Css, xhtml, javascript
Css, xhtml, javascriptCss, xhtml, javascript
Css, xhtml, javascript
 
ARTDM 170, Week 3: Rollovers
ARTDM 170, Week 3: RolloversARTDM 170, Week 3: Rollovers
ARTDM 170, Week 3: Rollovers
 
ARTDM 170, Week 3: Rollovers
ARTDM 170, Week 3: RolloversARTDM 170, Week 3: Rollovers
ARTDM 170, Week 3: Rollovers
 
HalfStack London - Make Your Animations Perform Well
HalfStack London - Make Your Animations Perform Well HalfStack London - Make Your Animations Perform Well
HalfStack London - Make Your Animations Perform Well
 
Seven deadly theming sins
Seven deadly theming sinsSeven deadly theming sins
Seven deadly theming sins
 
Joomla! Day UK 2009 Basic Templates
Joomla! Day UK 2009 Basic TemplatesJoomla! Day UK 2009 Basic Templates
Joomla! Day UK 2009 Basic Templates
 
Joomla Day UK 2009 Basic Templates
Joomla Day UK 2009 Basic TemplatesJoomla Day UK 2009 Basic Templates
Joomla Day UK 2009 Basic Templates
 
Make your animations perform well - Anna Migas - Codemotion Rome 2017
Make your animations perform well - Anna Migas - Codemotion Rome 2017Make your animations perform well - Anna Migas - Codemotion Rome 2017
Make your animations perform well - Anna Migas - Codemotion Rome 2017
 
Make your animations perform well
Make your animations perform wellMake your animations perform well
Make your animations perform well
 
[PSU Web 2011] HTML5 Design
[PSU Web 2011] HTML5 Design[PSU Web 2011] HTML5 Design
[PSU Web 2011] HTML5 Design
 
Installing And Configuration for your Wordpress blog
Installing And Configuration for your Wordpress blogInstalling And Configuration for your Wordpress blog
Installing And Configuration for your Wordpress blog
 
Theme Kickstart
Theme KickstartTheme Kickstart
Theme Kickstart
 
Html5
Html5Html5
Html5
 
html5_css3
html5_css3html5_css3
html5_css3
 
Minimalism in Web Development
Minimalism in Web DevelopmentMinimalism in Web Development
Minimalism in Web Development
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 

Revolver

  • 1. Revolver Animating with HTML5 + CSS3 Web Design Track - Intermediate Level
  • 2. Assumes student has completed DASH projects 1 and 2. Provide a zip file download that contains: Final project looks like this !
  • 3. “Unzip” the project folder by double-clicking on it. Check out what’s inside: Look inside the images folder Open revolver.html in Brackets (don’t worry, it’s supposed to be blank!)
  • 4. Let’s start by giving revolver.html a basic HTML structure: <!DOCTYPE html> <html> <head> <title>Revolver</title> </head> <body> <div id="main"> </div> </body> </html>
  • 5. Inside the <head>, add a <style> tag and set the body background: <style> body { background: url(“images/space.jpg”); background-size: cover; } </style> Turn on Live Preview → The background should fill the whole browser:
  • 6. Now let’s add the sun. Inside the #main <div>, add an <img> tag with a class and a source: <img class=“sun” src=“images/sun.gif”> Then, add a second <img> tag to make the planet appear too. Live Preview →
  • 7. Now let’s go back into <style> and add some CSS to center the #main <style> body { background: url(“images/space.jpg”); background-size: cover; } #main { margin: 0 auto; width: 800px; position: relative; } </style> Check out Live Preview →
  • 8. Now let’s style the planet class <style> body { background: url(“images/space.jpg”); background-size: cover; } #main { margin: 0 auto; width: 800px; position: relative; } .planet { width: 70px; /* shrink (or grow) the planet */ position: absolute; left: 315px; /* tell it how far to move over from the left */ top: 350px; /* tell it how far to move down from the top */
  • 9. Next, style .sun so it has the same position as .planet <style> body { background: url(“images/space.jpg”); background-size: cover; } #main { margin: 0 auto; width: 800px; position: relative; } .planet { width: 70px; /* shrinks the planet */ position: absolute; left: 315px; /* tells it how far to move over from the left */ top: 350px; /* tells it how far to move down from the top */ } .sun { position: ???; left: ???; top: ???;
  • 10. Now we need to add the transform property and animation code to the .planet class .planet { width: 70px; position: absolute; left: 315px; top: 350px; transform: rotate(45deg) translateX(250px) rotate(-45deg); /* This is the vendor prefix code. It sets the animation type, speed, speed curve, and how many times it should run */ -webkit-animation: myOrbit 6s linear infinite; /* Chrome, Safari 5 */ -moz-animation: myOrbit 6s linear infinite; /* Firefox 5-15 */ -o-animation: myOrbit 6s linear infinite; /* Opera 12+ */ animation: myOrbit 6s linear infinite; /* Chrome, Firefox 16+, IE 10+, Safari 5 */ }
  • 11. Last thing is to add @keyframes right before </style> (not inside .planet !) /* This is @keyframes. This code controls what the animation looks like */ @-webkit-keyframes myOrbit { from { -webkit-transform: rotate(0deg) translateX(250px) rotate(0deg); } to { -webkit-transform: rotate(360deg) translateX(250px) rotate(-360deg); } } @-moz-keyframes myOrbit { from { -moz-transform: rotate(0deg) translateX(250px) rotate(0deg); } to { -moz-transform: rotate(360deg) translateX(250px) rotate(-360deg); } } @-o-keyframes myOrbit { from { -o-transform: rotate(0deg) translateX(250px) rotate(0deg); } to { -o-transform: rotate(360deg) translateX(250px) rotate(-360deg); } } @keyframes myOrbit { from { transform: rotate(0deg) translateX(250px) rotate(0deg); } to { transform: rotate(360deg) translateX(250px) rotate(-360deg); } }