SlideShare a Scribd company logo
1 of 38
What is HTML5 ?
●

Html5 is the latest technology of the HTML standard(originally
created in 1990).

●

Html5 is an improvement of HTML4.0 and XHTML1.0.

●

Work started in 2003 by W3C and WHATWG.

●

●

●

A change from document markup language to web application
language.
An attempt to enhance the functionality and flexibility of the web.
Html5 is language for structuring and presenting content for the
World Wide Web.
New in HTML5 Features:
●
●

●
●

●

The <canvas> element for 2D drawing
The <video> and <audio> elements for media
playback
Support for local storage
New content-specific elements, like <article>,
<footer>, <header>, <nav>, <section>
New form controls, like calendar, date, time,
email, url, search
HTML5 Canvas
●

●

●

●

●

A canvas is a rectangular area on an HTML page, and it is
specified with the <canvas> element.
The HTML5 <canvas> element is used to draw graphics, on the
fly, via scripting (usually JavaScript).
The <canvas> element is only a container for graphics. You
must use a script to actually draw the graphics.
Canvas has several methods for drawing paths, boxes, circles,
text, and adding images.
The markup looks like this:
<canvas id="myCanvas" width="200" height="100"></canvas>

Note: By default, the <canvas> element has no border and no
content.
Canvas Coordinates
●

The canvas is a two-dimensional grid.

●

The upper-left corner of the canvas has coordinate (0,0) .

●

Example: Suppose we have parameters of a rectangle
as(0,0,150,75):
This means: Start at the upper-left corner (0,0) and draw a
150x75 pixels rectangle.

●
●

●

Example:
Result
Canvas – Paths
(straight line)
●

To draw straight lines on a canvas, we will use the
following two methods:
- moveTo(x,y) defines the starting point of the line
- lineTo(x,y) defines the ending point of the line

●

To actually draw the line, we must use one of the "ink"
methods, like stroke().
Canvas – Paths
(straight line)
●

Example:
at (200,200).

Draw a straight line starting from (0,0) and ending
Canvas – Paths
(straight line)
●

Output:
Canvas – Paths
(circle)
●

To draw a circle on a canvas, we will use the following
method:
- arc(x,y,r,start,stop)

●

To actually draw the circle, we must use one of the "ink"
methods, like stroke() or fill().
Canvas – Paths
(circle)
●

Example: To create a circle with the arc method.
Canvas – Paths
(circle)

●

Output:
Canvas - Text
●

To draw text on a canvas, the most important property and
methods are:
- font - defines the font properties for text
- fillText(text,x,y) - Draws "filled" text on the canvas
- strokeText(text,x,y) - Draws text on the canvas (no fill)
Canvas - Text
●

Example: Using filltext():
Canvas - Text
●

Output:
What is SVG?
●

SVG stands for Scalable Vector Graphics

●

SVG is used to define vector-based graphics for the Web

●

SVG defines the graphics in XML format

●

SVG graphics do NOT lose any quality if they are zoomed or re
sized

●

Every element and every attribute in SVG files can be animated

●

SVG is a W3C recommendation
SVG Advantages
●

Advantages of using SVG over other image formats (like
JPEG and GIF) are:

-These can be created and edited with any text editor
- Can be searched, indexed, scripted, and compressed
- Are scalable
- Can be printed with high quality at any resolution
- Are zoom able
Comparison of Canvas and SVG
SVG Shape Elements
●

SVG has some predefined shape elements that can be used by
developers:
- Rectangle <rect>
- Circle <circle>
- Ellipse <ellipse>
- Line <line>
- Polyline <polyline>
- Polygon <polygon>
- Path <path>
SVG
●

Example:
SVG
●

Output:
HTML5 Drag and Drop
●

●

In HTML5, drag and drop is part of the standard, and any
element can be drag gable.
Make an Element Drag gable
<img draggable="true">

●

The dataTransfer.setData() method sets the data type and the
value of the dragged data:
function drag(ev)
{
ev.dataTransfer.setData("Text",ev.target.id);
}
HTML5 Geolocation
●

●

●

●

The HTML5 Geolocation API is used to get the geographical
position of a user.
this can compromise user privacy, the position is not available
unless the user approves it.
In HTML5 the getCurrentPosition() method is used to get the
user's position.
Geolocation is mainly used for the following purposes:
1. Displaying the Result in a Map
2. Location-specific Information
3. Handling Errors and Rejections
HTML5 VIDEO
●

●

●

HTML5 defines a new element which specifies
a standard way to embed a video/movie on a
web page: the <video> element.
You should also insert text content between the
<video> and </video> tags for browsers that do
not support the <video> element.
The <video> element allows multiple <source>
elements. <source> elements can link to
different video files.
HTML5 VIDEO
●

Example:
HTML5 Video
●

Output:
HTML Sounds / Audio
●

The HTML5 <audio> tag defines sound, such as music or other
audio streams.

●

The <audio> element works in all modern browsers.

●

Example:
HTML5 Input Types
●

HTML5 has several new input types for forms.

●

Some of them are:
- color
- date
- email
- number
- range
- time

●

These new features allow better input control and validation.
HTML5 Form Elements
●

HTML5 has the following new form elements:
- <datalist>
- <keygen>
- <output>
HTML5 <datalist> Element
●

●

●

●

●

The <datalist> element specifies a list of pre-defined options for
an <input> element.
The <datalist> element is used to provide an "autocomplete"
feature on <input> elements.
Users will see a drop-down list of pre-defined options as they
input data.
Use the <input> element's list attribute to bind it together with a
<datalist> element.
Example: <input list="browsers">
<datalist id="browsers">
<option value="Internet Explorer">
<option value="Firefox">
<option value="Chrome">
</datalist>
HTML5 <keygen> Element
●

●

●

●

●

●

The purpose of the <keygen> element is to provide a secure
way to authenticate users.
The <keygen> tag specifies a key-pair generator field in a form.
When the form is submitted, two keys are generated, one
private and one public.
The private key is stored locally, and the public key is sent to
the server.
The public key could be used to generate a client certificate to
authenticate the user in the future.
Example:

<form action="demo_keygen.asp" method="get">
Username: <input type="text" name="usr_name">
Encryption: <keygen name="security">
<input type="submit">
</form>
HTML5 <output> Element
●

●

The <output> element represents the result of a calculation (like
one performed by a script).
Example:
<form oninput="x.value=parseInt(a.value)+parseInt(b.value)">0
<input type="range" id="a" value="50">100 +
<input type="number" id="b" value="50">=
<output name="x" for="a b"></output>
</form>
HTML5 Form Attributes
●

HTML5 has several new attributes for <form> and <input>.

●

New attributes for <form>:
- autocomplete
- novalidate

●

New attributes for <input>:
- autocomplete

- height and width

- autofocus

- list

- form

- min and max

- formaction

- multiple

- formmethod

- pattern

- formnovalidate

- step
HTML5 Semantic Elements
●

●

A semantic element clearly describes its meaning to both the
browser and the developer.
HTML5 offers new semantic elements to clearly define different
parts of a web page:
- <header>
- <nav>
- <section>
- <article>
- <aside>
- <figcaption>
- <figure>
- <footer>
HTML5 Web Storage
●

●

●

●

●

●

With HTML5, web pages can store data locally within the user's
browser.
Web Storage is more secure and faster.
The data is not included with every server request, but used
ONLY when asked for.
It is also possible to store large amounts of data, without
affecting the website's performance.
It is also possible to store large amounts of data, without
affecting the website's performance.
There are two new objects for storing data on the client:
- localStorage - stores data with no expiration date
- sessionStorage - stores data for one session
The localStorage Object
●

●

●

The localStorage object stores the data with no
expiration date.
The data will not be deleted when the browser
is closed, and will be available the next day,
week, or year.
Example:

localStorage.lastname="Smith";
document.getElementById("result").innerHTML="Last name: "+
localStorage.lastname
The sessionStorage Object
●

●

The sessionStorage object is equal to the localStorage object,
except that it stores the data for only one session. The data is
deleted when the user closes the browser window.
Example:
if (sessionStorage.clickcount)
sessionStorage.clickcount=Number(sessionStorage.clickcount)+1;
else
sessionStorage.clickcount=1;
document.getElementById("result").innerHTML="You have clicked the button
" + sessionStorage.clickcount + " time(s) in this session.";
HTML5 Application Cache
●

●

●

●

●

HTML5 introduces application cache, which means that a web
application is cached, and accessible without an internet
connection.
Application cache gives an application three advantages:
Offline browsing - users can use the application when they're
offline
Speed - cached resources load faster
Reduced server load - the browser will only download
updated/changed resources from the server
HTML5 Web Workers
●

●

●

A web worker is a JavaScript running in the background,
without affecting the performance of the page.
You can continue to do whatever you want: clicking, selecting
things, etc., while the web worker runs in the background.
Since web workers are in external files, they do not have
access to the following JavaScript objects:
- The window object
- The document object
- The parent object
Thank You

More Related Content

What's hot

1. introduction to html5
1. introduction to html51. introduction to html5
1. introduction to html5
JayjZens
 

What's hot (20)

Chapter 8 Enhancing a website with multimedia
Chapter 8 Enhancing a website with multimediaChapter 8 Enhancing a website with multimedia
Chapter 8 Enhancing a website with multimedia
 
e-suap - client technologies- english version
e-suap - client technologies- english versione-suap - client technologies- english version
e-suap - client technologies- english version
 
Javascript and DOM
Javascript and DOMJavascript and DOM
Javascript and DOM
 
1. introduction to html5
1. introduction to html51. introduction to html5
1. introduction to html5
 
UIWebView Tips
UIWebView TipsUIWebView Tips
UIWebView Tips
 
jQuery - Chapter 1 - Introduction
 jQuery - Chapter 1 - Introduction jQuery - Chapter 1 - Introduction
jQuery - Chapter 1 - Introduction
 
Graphics & Animation with HTML5
Graphics & Animation with HTML5Graphics & Animation with HTML5
Graphics & Animation with HTML5
 
JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)
 
Html 5 - What's new?
Html 5 - What's new?Html 5 - What's new?
Html 5 - What's new?
 
Learn D3.js in 90 minutes
Learn D3.js in 90 minutesLearn D3.js in 90 minutes
Learn D3.js in 90 minutes
 
Intro to DTCoreText: Moving Past UIWebView | iOS Development
Intro to DTCoreText: Moving Past UIWebView | iOS DevelopmentIntro to DTCoreText: Moving Past UIWebView | iOS Development
Intro to DTCoreText: Moving Past UIWebView | iOS Development
 
Ajax for dummies, and not only.
Ajax for dummies, and not only.Ajax for dummies, and not only.
Ajax for dummies, and not only.
 
Java script
Java scriptJava script
Java script
 
Ubuntu app development
Ubuntu app development Ubuntu app development
Ubuntu app development
 
Javascript 2
Javascript 2Javascript 2
Javascript 2
 
SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...
SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...
SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...
 
Unit 4(it workshop)
Unit 4(it workshop)Unit 4(it workshop)
Unit 4(it workshop)
 
JavaScript
JavaScriptJavaScript
JavaScript
 
JSON
JSONJSON
JSON
 
Model-View-Update, and Beyond!
Model-View-Update, and Beyond!Model-View-Update, and Beyond!
Model-View-Update, and Beyond!
 

Viewers also liked

Andika Widia Putra_Teknik Pelaksanaaan Konstruksi_Alat berat_Crane
Andika Widia Putra_Teknik Pelaksanaaan Konstruksi_Alat berat_CraneAndika Widia Putra_Teknik Pelaksanaaan Konstruksi_Alat berat_Crane
Andika Widia Putra_Teknik Pelaksanaaan Konstruksi_Alat berat_Crane
Andika Widia Putra
 
Yeni microsoft office power point sunusu kopya
Yeni microsoft office power point sunusu   kopyaYeni microsoft office power point sunusu   kopya
Yeni microsoft office power point sunusu kopya
3ness
 

Viewers also liked (15)

Andika Widia Putra - Perencanaan Masjid
Andika Widia Putra - Perencanaan MasjidAndika Widia Putra - Perencanaan Masjid
Andika Widia Putra - Perencanaan Masjid
 
Andika Widia Putra_Teknik Pelaksanaaan Konstruksi_Alat berat_Crane
Andika Widia Putra_Teknik Pelaksanaaan Konstruksi_Alat berat_CraneAndika Widia Putra_Teknik Pelaksanaaan Konstruksi_Alat berat_Crane
Andika Widia Putra_Teknik Pelaksanaaan Konstruksi_Alat berat_Crane
 
NUTRIÇÃO
NUTRIÇÃONUTRIÇÃO
NUTRIÇÃO
 
Yeni microsoft office power point sunusu kopya
Yeni microsoft office power point sunusu   kopyaYeni microsoft office power point sunusu   kopya
Yeni microsoft office power point sunusu kopya
 
Andika Widia Putra - Desain rumah -
Andika Widia Putra - Desain rumah - Andika Widia Putra - Desain rumah -
Andika Widia Putra - Desain rumah -
 
Andika Widia Putra - Desain Rumah
Andika Widia Putra - Desain Rumah Andika Widia Putra - Desain Rumah
Andika Widia Putra - Desain Rumah
 
Andika Widia Putra - Perencanaan Pasar
Andika Widia Putra - Perencanaan Pasar Andika Widia Putra - Perencanaan Pasar
Andika Widia Putra - Perencanaan Pasar
 
Lost
LostLost
Lost
 
Andika Widia Putra - Desain Rumah
Andika Widia Putra - Desain Rumah Andika Widia Putra - Desain Rumah
Andika Widia Putra - Desain Rumah
 
The Delivery Of Bad News In An Organizations
The Delivery Of Bad News In An OrganizationsThe Delivery Of Bad News In An Organizations
The Delivery Of Bad News In An Organizations
 
Andika Widia Putra - Desain Rumah
Andika Widia Putra - Desain Rumah Andika Widia Putra - Desain Rumah
Andika Widia Putra - Desain Rumah
 
Andika Widia Putra - Desain Rumah
Andika Widia Putra - Desain Rumah Andika Widia Putra - Desain Rumah
Andika Widia Putra - Desain Rumah
 
Andika Widia Putra - Desain Rumah
Andika Widia Putra - Desain Rumah Andika Widia Putra - Desain Rumah
Andika Widia Putra - Desain Rumah
 
seminar on tessellation
seminar on tessellation seminar on tessellation
seminar on tessellation
 
Perilaku kelompok dalam organisasi
Perilaku kelompok dalam organisasiPerilaku kelompok dalam organisasi
Perilaku kelompok dalam organisasi
 

Similar to Html5

Html5ppt
Html5pptHtml5ppt
Html5ppt
recroup
 
Basic html5 and javascript
Basic html5 and javascriptBasic html5 and javascript
Basic html5 and javascript
wendy017
 
HTML5 New Features and Resources
HTML5 New Features and ResourcesHTML5 New Features and Resources
HTML5 New Features and Resources
Ron Reiter
 

Similar to Html5 (20)

New Elements & Features in HTML5
New Elements & Features in HTML5New Elements & Features in HTML5
New Elements & Features in HTML5
 
Html5 Future of WEB
Html5 Future of WEBHtml5 Future of WEB
Html5 Future of WEB
 
Rohit&kunjan
Rohit&kunjanRohit&kunjan
Rohit&kunjan
 
Html5
Html5Html5
Html5
 
Html5ppt
Html5pptHtml5ppt
Html5ppt
 
Html5
Html5Html5
Html5
 
HTML 5
HTML 5HTML 5
HTML 5
 
Basic html5 and javascript
Basic html5 and javascriptBasic html5 and javascript
Basic html5 and javascript
 
Html5 CSS3 jQuery Basic
Html5 CSS3 jQuery BasicHtml5 CSS3 jQuery Basic
Html5 CSS3 jQuery Basic
 
Html 5
Html 5Html 5
Html 5
 
WP - Unit I.ppt
WP - Unit I.pptWP - Unit I.ppt
WP - Unit I.ppt
 
HTML5: An Introduction To Next Generation Web Development
HTML5: An Introduction To Next Generation Web DevelopmentHTML5: An Introduction To Next Generation Web Development
HTML5: An Introduction To Next Generation Web Development
 
JavaScripts & jQuery
JavaScripts & jQueryJavaScripts & jQuery
JavaScripts & jQuery
 
Performance (browser)
Performance (browser)Performance (browser)
Performance (browser)
 
Javascript
JavascriptJavascript
Javascript
 
HTML5 Refresher
HTML5 RefresherHTML5 Refresher
HTML5 Refresher
 
HTML5 New Features and Resources
HTML5 New Features and ResourcesHTML5 New Features and Resources
HTML5 New Features and Resources
 
Ddpz2613 topic9 java
Ddpz2613 topic9 javaDdpz2613 topic9 java
Ddpz2613 topic9 java
 
OpenCms Days 2014 - User Generated Content in OpenCms 9.5
OpenCms Days 2014 - User Generated Content in OpenCms 9.5OpenCms Days 2014 - User Generated Content in OpenCms 9.5
OpenCms Days 2014 - User Generated Content in OpenCms 9.5
 
HTML 5
HTML 5HTML 5
HTML 5
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

Html5

  • 1. What is HTML5 ? ● Html5 is the latest technology of the HTML standard(originally created in 1990). ● Html5 is an improvement of HTML4.0 and XHTML1.0. ● Work started in 2003 by W3C and WHATWG. ● ● ● A change from document markup language to web application language. An attempt to enhance the functionality and flexibility of the web. Html5 is language for structuring and presenting content for the World Wide Web.
  • 2. New in HTML5 Features: ● ● ● ● ● The <canvas> element for 2D drawing The <video> and <audio> elements for media playback Support for local storage New content-specific elements, like <article>, <footer>, <header>, <nav>, <section> New form controls, like calendar, date, time, email, url, search
  • 3. HTML5 Canvas ● ● ● ● ● A canvas is a rectangular area on an HTML page, and it is specified with the <canvas> element. The HTML5 <canvas> element is used to draw graphics, on the fly, via scripting (usually JavaScript). The <canvas> element is only a container for graphics. You must use a script to actually draw the graphics. Canvas has several methods for drawing paths, boxes, circles, text, and adding images. The markup looks like this: <canvas id="myCanvas" width="200" height="100"></canvas> Note: By default, the <canvas> element has no border and no content.
  • 4. Canvas Coordinates ● The canvas is a two-dimensional grid. ● The upper-left corner of the canvas has coordinate (0,0) . ● Example: Suppose we have parameters of a rectangle as(0,0,150,75): This means: Start at the upper-left corner (0,0) and draw a 150x75 pixels rectangle. ● ● ● Example: Result
  • 5. Canvas – Paths (straight line) ● To draw straight lines on a canvas, we will use the following two methods: - moveTo(x,y) defines the starting point of the line - lineTo(x,y) defines the ending point of the line ● To actually draw the line, we must use one of the "ink" methods, like stroke().
  • 6. Canvas – Paths (straight line) ● Example: at (200,200). Draw a straight line starting from (0,0) and ending
  • 7. Canvas – Paths (straight line) ● Output:
  • 8. Canvas – Paths (circle) ● To draw a circle on a canvas, we will use the following method: - arc(x,y,r,start,stop) ● To actually draw the circle, we must use one of the "ink" methods, like stroke() or fill().
  • 9. Canvas – Paths (circle) ● Example: To create a circle with the arc method.
  • 11. Canvas - Text ● To draw text on a canvas, the most important property and methods are: - font - defines the font properties for text - fillText(text,x,y) - Draws "filled" text on the canvas - strokeText(text,x,y) - Draws text on the canvas (no fill)
  • 12. Canvas - Text ● Example: Using filltext():
  • 14. What is SVG? ● SVG stands for Scalable Vector Graphics ● SVG is used to define vector-based graphics for the Web ● SVG defines the graphics in XML format ● SVG graphics do NOT lose any quality if they are zoomed or re sized ● Every element and every attribute in SVG files can be animated ● SVG is a W3C recommendation
  • 15. SVG Advantages ● Advantages of using SVG over other image formats (like JPEG and GIF) are: -These can be created and edited with any text editor - Can be searched, indexed, scripted, and compressed - Are scalable - Can be printed with high quality at any resolution - Are zoom able
  • 17. SVG Shape Elements ● SVG has some predefined shape elements that can be used by developers: - Rectangle <rect> - Circle <circle> - Ellipse <ellipse> - Line <line> - Polyline <polyline> - Polygon <polygon> - Path <path>
  • 20. HTML5 Drag and Drop ● ● In HTML5, drag and drop is part of the standard, and any element can be drag gable. Make an Element Drag gable <img draggable="true"> ● The dataTransfer.setData() method sets the data type and the value of the dragged data: function drag(ev) { ev.dataTransfer.setData("Text",ev.target.id); }
  • 21. HTML5 Geolocation ● ● ● ● The HTML5 Geolocation API is used to get the geographical position of a user. this can compromise user privacy, the position is not available unless the user approves it. In HTML5 the getCurrentPosition() method is used to get the user's position. Geolocation is mainly used for the following purposes: 1. Displaying the Result in a Map 2. Location-specific Information 3. Handling Errors and Rejections
  • 22. HTML5 VIDEO ● ● ● HTML5 defines a new element which specifies a standard way to embed a video/movie on a web page: the <video> element. You should also insert text content between the <video> and </video> tags for browsers that do not support the <video> element. The <video> element allows multiple <source> elements. <source> elements can link to different video files.
  • 25. HTML Sounds / Audio ● The HTML5 <audio> tag defines sound, such as music or other audio streams. ● The <audio> element works in all modern browsers. ● Example:
  • 26. HTML5 Input Types ● HTML5 has several new input types for forms. ● Some of them are: - color - date - email - number - range - time ● These new features allow better input control and validation.
  • 27. HTML5 Form Elements ● HTML5 has the following new form elements: - <datalist> - <keygen> - <output>
  • 28. HTML5 <datalist> Element ● ● ● ● ● The <datalist> element specifies a list of pre-defined options for an <input> element. The <datalist> element is used to provide an "autocomplete" feature on <input> elements. Users will see a drop-down list of pre-defined options as they input data. Use the <input> element's list attribute to bind it together with a <datalist> element. Example: <input list="browsers"> <datalist id="browsers"> <option value="Internet Explorer"> <option value="Firefox"> <option value="Chrome"> </datalist>
  • 29. HTML5 <keygen> Element ● ● ● ● ● ● The purpose of the <keygen> element is to provide a secure way to authenticate users. The <keygen> tag specifies a key-pair generator field in a form. When the form is submitted, two keys are generated, one private and one public. The private key is stored locally, and the public key is sent to the server. The public key could be used to generate a client certificate to authenticate the user in the future. Example: <form action="demo_keygen.asp" method="get"> Username: <input type="text" name="usr_name"> Encryption: <keygen name="security"> <input type="submit"> </form>
  • 30. HTML5 <output> Element ● ● The <output> element represents the result of a calculation (like one performed by a script). Example: <form oninput="x.value=parseInt(a.value)+parseInt(b.value)">0 <input type="range" id="a" value="50">100 + <input type="number" id="b" value="50">= <output name="x" for="a b"></output> </form>
  • 31. HTML5 Form Attributes ● HTML5 has several new attributes for <form> and <input>. ● New attributes for <form>: - autocomplete - novalidate ● New attributes for <input>: - autocomplete - height and width - autofocus - list - form - min and max - formaction - multiple - formmethod - pattern - formnovalidate - step
  • 32. HTML5 Semantic Elements ● ● A semantic element clearly describes its meaning to both the browser and the developer. HTML5 offers new semantic elements to clearly define different parts of a web page: - <header> - <nav> - <section> - <article> - <aside> - <figcaption> - <figure> - <footer>
  • 33. HTML5 Web Storage ● ● ● ● ● ● With HTML5, web pages can store data locally within the user's browser. Web Storage is more secure and faster. The data is not included with every server request, but used ONLY when asked for. It is also possible to store large amounts of data, without affecting the website's performance. It is also possible to store large amounts of data, without affecting the website's performance. There are two new objects for storing data on the client: - localStorage - stores data with no expiration date - sessionStorage - stores data for one session
  • 34. The localStorage Object ● ● ● The localStorage object stores the data with no expiration date. The data will not be deleted when the browser is closed, and will be available the next day, week, or year. Example: localStorage.lastname="Smith"; document.getElementById("result").innerHTML="Last name: "+ localStorage.lastname
  • 35. The sessionStorage Object ● ● The sessionStorage object is equal to the localStorage object, except that it stores the data for only one session. The data is deleted when the user closes the browser window. Example: if (sessionStorage.clickcount) sessionStorage.clickcount=Number(sessionStorage.clickcount)+1; else sessionStorage.clickcount=1; document.getElementById("result").innerHTML="You have clicked the button " + sessionStorage.clickcount + " time(s) in this session.";
  • 36. HTML5 Application Cache ● ● ● ● ● HTML5 introduces application cache, which means that a web application is cached, and accessible without an internet connection. Application cache gives an application three advantages: Offline browsing - users can use the application when they're offline Speed - cached resources load faster Reduced server load - the browser will only download updated/changed resources from the server
  • 37. HTML5 Web Workers ● ● ● A web worker is a JavaScript running in the background, without affecting the performance of the page. You can continue to do whatever you want: clicking, selecting things, etc., while the web worker runs in the background. Since web workers are in external files, they do not have access to the following JavaScript objects: - The window object - The document object - The parent object