SlideShare a Scribd company logo
Mark Embling
What’s New?New semantic elementsNew form <input> typesData attributesAudio/video capabilitiesJS APIsCanvasGeo-locationOffline storageSome of these are technically not part of the HTML5 spec (anymore)
But first…A doctype which it’s actually possible to remember:<DOCTYPE html>Puts all the browsers into standards modeThat’s about all it does
… and …<meta charset="utf-8">instead of<meta http-equiv="Content-Type"       value="text/html;charset=utf-8">
Semantic Elements<header><hgroup><nav><article><section><aside><figure><figcaption><time><meter><progress><mark><footer>Not a full list
Semantic Elements<DOCTYPE html><html><head><!-- stuff --></head><body>    <header><h1>My Really Rubbish Blog Demo</h1></header>    <nav><ul><!-- menu items… --></ul></nav>    <article>        <header><h1>Interesting Post</h1></header>        <p>Blablabla. Interesting post here.</p>        <footer>            <p>Published on                 <time datetime="2011-03-30" pubdate>30th March ‘11</time></p>        </footer>    </article>    <!-- some more articles -->    <footer><p>Copyright  Me 2011</p></footer></body></html>
Semantic Elements<DOCTYPE html><html><head><!-- stuff --></head><body><header><h1>My Really Rubbish Blog Demo</h1></header>    <nav><ul><!-- menu items… --></ul></nav>    <article>        <header><h1>Interesting Post</h1></header>        <p>Blablabla. Interesting post here.</p>        <footer>            <p>Published on                 <time datetime="2011-03-30" pubdate>30th March ‘11</time></p>        </footer>    </article>    <!-- some more articles --><footer><p>Copyright  Me 2011</p></footer></body></html>
Semantic Elements<DOCTYPE html><html><head><!-- stuff --></head><body>    <header><h1>My Really Rubbish Blog Demo</h1></header><nav><ul><!-- menu items… --></ul></nav>    <article>        <header><h1>Interesting Post</h1></header>        <p>Blablabla. Interesting post here.</p>        <footer>            <p>Published on                 <time datetime="2011-03-30" pubdate>30th March ‘11</time></p>        </footer>    </article>    <!-- some more articles -->    <footer><p>Copyright  Me 2011</p></footer></body></html><nav>    <ul>        <li><a href="/">Home</a></li>        <li><a href="/things">Things</a></li>        <li><a href="/widgets">Widgets</a></li><li><a href="/doodads">Doodads</a></li>        <li><a href="/thingumybobs">Thingumybobs</a></li>        <li><a href="/contact">Contact Us</a></li>    </ul></nav>
Semantic Elements<DOCTYPE html><html><head><!-- stuff --></head><body>    <header><h1>My Really Rubbish Blog Demo</h1></header>    <nav><ul><!-- menu items… --></ul></nav>    <article>        <header><h1>Interesting Post</h1></header>        <p>Blablabla. Interesting post here.</p>        <footer>            <p>Published on                 <time datetime="2011-03-30" pubdate>30th March ‘11</time></p>        </footer>    </article>    <!-- some more articles -->    <footer><p>Copyright  Me 2011</p></footer></body></html>
Semantic Elements<DOCTYPE html><html><head><!-- stuff --></head><body>    <header><h1>My Really Rubbish Blog Demo</h1></header>    <nav><ul><!-- menu items… --></ul></nav>    <article>        <header><h1>Interesting Post</h1></header>        <p>Blablabla. Interesting post here.</p>        <footer>            <p>Published on <time datetime="2011-03-30" pubdate>30th March ‘11</time></p>        </footer>    </article>    <!-- some more articles -->    <footer><p>Copyright  Me 2011</p></footer></body></html>
Semantic Elements: IE ≤ 8IE ignores them by defaultCannot be styledHTML5 Shimhttp://remysharp.com/2009/01/07/html5-enabling-script/http://code.google.com/p/html5shim/<!--[if lt IE 9]><script src="…/html5.js"></script><![endif]-->
Dropped ElementsDeprecated elements in HTML 4.01 & XHTML 1 are gone:<applet><acronym>(use <abbr> instead)<frame> / <frameset><font><center><u><blink> & <marquee><tt>Good riddance!Not a full list
Form Input TypesMore specific input typesBrowsers can present optimised controls/keyboards/UIemailcolordatedatetimedatetime-localemailmonthnumberrangesearchteltimeurlweekBrowser support right now is patchyIf not supported, it’ll default to a standard text input
Form ValidationAttributes for validation of input	pattern	required	min/maxNot quite there yet in terms of supportOpera is probably best nowBut no ability to change/style validation errors
Data AttributesAllows arbitrary pieces of data to be attached to any elementThe sort of data which doesn’t belong in class or idData can be used via JSClient-side sortingBinding/templatingBuild client-side visualisationsAnything!
Data AttributesAny attribute beginning with data-<trdata-person-ref="1003">…</tr><trdata-sorting-key="bloggsjoe">…</tr><button data-bind="enable: SaveEnabled">…</button>Ignored by the browser and validatorsNo browser (including old ones) will be upset by thisApply to any element you want
MultimediaNative audio and video in the browser (no plugins)<audio>OggVorbis, MP3, AAC (M4A), WAV (browser dependant)<video>WebM, Ogg (Theora + Vorbis), MP4 (H.264 + AAC)(browser dependant)
Multimedia<audio src="music.mp3" controls>Fallback content</audio>or<audio controls>    <source src="music.m4a" type="audio/mp4">    <source src="music.mp3" type="audio/mpeg">Fallback content</audio>
CanvasA raster-based drawing surface right there in the pageManipulate via JavaScript2D currently (3D coming)Browser support: all modern browsers & IE6-8 with helpExcanvascode.google.com/p/explorercanvas/<canvas id="mycanvas" width="400"                         height="300">Fallback content</canvas>
CanvasData visualisationGraphs code.google.com/p/flot/Dials/gaugesAnimation and effectsGamesRob Hawkes’ Rawketsrawkets.com
RawketsCanvas & websockets game by Rob Hawkesrawkets.com
CanvasGet the context for the canvas. This is what is used for drawing.var canvas = document.getElementById("mycanvas");var context = canvas.getContext("2d");or with jQuery…var canvas = $("#mycanvas").get(0);var context = canvas.getContext("2d");
CanvasDo some drawing// Draw a couple of rectanglescontext.fillRect(x, y, w, h);context.strokeRect(x, y, w, h);// Draw a linecontext.beginPath();context.moveTo(x, y);context.lineTo(x, y);context.closePath();
CanvasRepeat step 2Maybe do some more drawingfillRect(x, y, w, h)strokeRect(x, y, w, h)beginPath()closePath()moveTo(x, y)fill()stroke()lineTo(x, y)rect(x, y, w, h)arc(x, y, radius, startAngle, endAngle,   anticlockwise)arcTo(x1, y1, x2, y2,   radius)Plus a lot more
Geo-locationFind the user’s location via JSNever happens without the user’s permissionAsks firstReturns an object:coords.latitudecoords.longitudecoords.altitudecoords.accuracycoords.altitudeAccuracycoords.headingcoords.speedtimestamp
HTML5
ResourcesStuff worth looking atDive Into HTML5diveintohtml5.orgMozilla Developer Networkdeveloper.mozilla.orgRawkes (Rob Hawkes’ Blog)rawkes.comHTML5 Logow3.org/html/logo/Stuff I’ve mentionedHTML5 Shimcode.google.com/p/html5shim/Excanvascode.google.com/p/explorercanvas/
Flot (canvas-based graphs)code.google.com/p/flot/

More Related Content

PPT
Week7
 
PPT
HTML Fundamentals
PPT
PPTX
HTML and CSS workshop
PPTX
New HTML5/CSS3 techniques
PPT
Html5: What is it?
PPTX
Html tags
KEY
HTML5 - techMaine Presentation 5/18/09
Week7
 
HTML Fundamentals
HTML and CSS workshop
New HTML5/CSS3 techniques
Html5: What is it?
Html tags
HTML5 - techMaine Presentation 5/18/09

What's hot (16)

PPT
Enterprise Google Gadgets Integrated with Alfresco - Open Source ECM
PPT
Html basics IML 140 (weeks 2-3)
PDF
Lca2009 Video A11y
PPT
HTML5 with examples
ODP
HTML5: 5 Quick Wins
PPT
PL2235 2009 1 HTML
PPTX
Html 5.0
PPTX
Be HTML5-ready today
PPTX
PPT
Ajax ons2
PPT
Lecture 6 - Comm Lab: Web @ ITP
PPT
JWU Guest Talk: JavaScript and AJAX
PDF
Introducing YUI
ODP
Optimizing Drupal for Mobile Devices
PPT
Microformats at Web 2.0 Expo April 2007
Enterprise Google Gadgets Integrated with Alfresco - Open Source ECM
Html basics IML 140 (weeks 2-3)
Lca2009 Video A11y
HTML5 with examples
HTML5: 5 Quick Wins
PL2235 2009 1 HTML
Html 5.0
Be HTML5-ready today
Ajax ons2
Lecture 6 - Comm Lab: Web @ ITP
JWU Guest Talk: JavaScript and AJAX
Introducing YUI
Optimizing Drupal for Mobile Devices
Microformats at Web 2.0 Expo April 2007
Ad

Viewers also liked (20)

PDF
Lear design con_east_2004_simplifing_mixed_signal_simulation
PPT
Ixtante Presentacion Slidesshare
PDF
V3 Report Example Mar 2011
PPT
Sampling
PPTX
Day by day
PPT
Ili agents presentation 2012 (portuguese)
PPT
Computer notes - singleRightRotation
PDF
Siemens HiPath 4000 Rel 5.0 using SIP via Cisco Unified Communications Manage...
PPT
Derechos constitucionales
PPTX
Oppstartsseminar valg 2011 rammevillkår
PDF
2011 Chassis Cab; Waldorf, MD
PPTX
10 most powerful countries in the world
PPTX
Technology K-12 in the classroom
PPTX
Au Psy492 M7 A3 E Portf De Bellis R
DOC
Actividades
Lear design con_east_2004_simplifing_mixed_signal_simulation
Ixtante Presentacion Slidesshare
V3 Report Example Mar 2011
Sampling
Day by day
Ili agents presentation 2012 (portuguese)
Computer notes - singleRightRotation
Siemens HiPath 4000 Rel 5.0 using SIP via Cisco Unified Communications Manage...
Derechos constitucionales
Oppstartsseminar valg 2011 rammevillkår
2011 Chassis Cab; Waldorf, MD
10 most powerful countries in the world
Technology K-12 in the classroom
Au Psy492 M7 A3 E Portf De Bellis R
Actividades
Ad

Similar to HTML5 (20)

PPT
Html5 Overview
PPT
Understanding html
PPT
XHTML basics
PPT
KMUTNB - Internet Programming 3/7
PPTX
HTML5 - One spec to rule them all
PPT
HTML5 Overview
PPT
HTML & CSS
PPT
PPT
Developing Gadgets
PPTX
Pratical HTML5
PPT
PPT
How To Create Personal Web Pages On My Web
PPT
Java Script
PPT
Learning HTML
PPT
Html ppt
PPT
Html Lesson01
PPT
ARTDM 171 Week 4: Tags
PPT
Introduction to html
PPT
Introduction to html
PPTX
HTML5 - What h#@$ is it?
Html5 Overview
Understanding html
XHTML basics
KMUTNB - Internet Programming 3/7
HTML5 - One spec to rule them all
HTML5 Overview
HTML & CSS
Developing Gadgets
Pratical HTML5
How To Create Personal Web Pages On My Web
Java Script
Learning HTML
Html ppt
Html Lesson01
ARTDM 171 Week 4: Tags
Introduction to html
Introduction to html
HTML5 - What h#@$ is it?

Recently uploaded (20)

PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Big Data Technologies - Introduction.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Cloud computing and distributed systems.
PDF
Approach and Philosophy of On baking technology
PDF
Encapsulation theory and applications.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
KodekX | Application Modernization Development
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Reach Out and Touch Someone: Haptics and Empathic Computing
The Rise and Fall of 3GPP – Time for a Sabbatical?
sap open course for s4hana steps from ECC to s4
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
NewMind AI Weekly Chronicles - August'25 Week I
Big Data Technologies - Introduction.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Machine learning based COVID-19 study performance prediction
Cloud computing and distributed systems.
Approach and Philosophy of On baking technology
Encapsulation theory and applications.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
cuic standard and advanced reporting.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
KodekX | Application Modernization Development
Chapter 3 Spatial Domain Image Processing.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...

HTML5

  • 2. What’s New?New semantic elementsNew form <input> typesData attributesAudio/video capabilitiesJS APIsCanvasGeo-locationOffline storageSome of these are technically not part of the HTML5 spec (anymore)
  • 3. But first…A doctype which it’s actually possible to remember:<DOCTYPE html>Puts all the browsers into standards modeThat’s about all it does
  • 4. … and …<meta charset="utf-8">instead of<meta http-equiv="Content-Type" value="text/html;charset=utf-8">
  • 6. Semantic Elements<DOCTYPE html><html><head><!-- stuff --></head><body> <header><h1>My Really Rubbish Blog Demo</h1></header> <nav><ul><!-- menu items… --></ul></nav> <article> <header><h1>Interesting Post</h1></header> <p>Blablabla. Interesting post here.</p> <footer> <p>Published on <time datetime="2011-03-30" pubdate>30th March ‘11</time></p> </footer> </article> <!-- some more articles --> <footer><p>Copyright Me 2011</p></footer></body></html>
  • 7. Semantic Elements<DOCTYPE html><html><head><!-- stuff --></head><body><header><h1>My Really Rubbish Blog Demo</h1></header> <nav><ul><!-- menu items… --></ul></nav> <article> <header><h1>Interesting Post</h1></header> <p>Blablabla. Interesting post here.</p> <footer> <p>Published on <time datetime="2011-03-30" pubdate>30th March ‘11</time></p> </footer> </article> <!-- some more articles --><footer><p>Copyright Me 2011</p></footer></body></html>
  • 8. Semantic Elements<DOCTYPE html><html><head><!-- stuff --></head><body> <header><h1>My Really Rubbish Blog Demo</h1></header><nav><ul><!-- menu items… --></ul></nav> <article> <header><h1>Interesting Post</h1></header> <p>Blablabla. Interesting post here.</p> <footer> <p>Published on <time datetime="2011-03-30" pubdate>30th March ‘11</time></p> </footer> </article> <!-- some more articles --> <footer><p>Copyright Me 2011</p></footer></body></html><nav> <ul> <li><a href="/">Home</a></li> <li><a href="/things">Things</a></li> <li><a href="/widgets">Widgets</a></li><li><a href="/doodads">Doodads</a></li> <li><a href="/thingumybobs">Thingumybobs</a></li> <li><a href="/contact">Contact Us</a></li> </ul></nav>
  • 9. Semantic Elements<DOCTYPE html><html><head><!-- stuff --></head><body> <header><h1>My Really Rubbish Blog Demo</h1></header> <nav><ul><!-- menu items… --></ul></nav> <article> <header><h1>Interesting Post</h1></header> <p>Blablabla. Interesting post here.</p> <footer> <p>Published on <time datetime="2011-03-30" pubdate>30th March ‘11</time></p> </footer> </article> <!-- some more articles --> <footer><p>Copyright Me 2011</p></footer></body></html>
  • 10. Semantic Elements<DOCTYPE html><html><head><!-- stuff --></head><body> <header><h1>My Really Rubbish Blog Demo</h1></header> <nav><ul><!-- menu items… --></ul></nav> <article> <header><h1>Interesting Post</h1></header> <p>Blablabla. Interesting post here.</p> <footer> <p>Published on <time datetime="2011-03-30" pubdate>30th March ‘11</time></p> </footer> </article> <!-- some more articles --> <footer><p>Copyright Me 2011</p></footer></body></html>
  • 11. Semantic Elements: IE ≤ 8IE ignores them by defaultCannot be styledHTML5 Shimhttp://remysharp.com/2009/01/07/html5-enabling-script/http://code.google.com/p/html5shim/<!--[if lt IE 9]><script src="…/html5.js"></script><![endif]-->
  • 12. Dropped ElementsDeprecated elements in HTML 4.01 & XHTML 1 are gone:<applet><acronym>(use <abbr> instead)<frame> / <frameset><font><center><u><blink> & <marquee><tt>Good riddance!Not a full list
  • 13. Form Input TypesMore specific input typesBrowsers can present optimised controls/keyboards/UIemailcolordatedatetimedatetime-localemailmonthnumberrangesearchteltimeurlweekBrowser support right now is patchyIf not supported, it’ll default to a standard text input
  • 14. Form ValidationAttributes for validation of input pattern required min/maxNot quite there yet in terms of supportOpera is probably best nowBut no ability to change/style validation errors
  • 15. Data AttributesAllows arbitrary pieces of data to be attached to any elementThe sort of data which doesn’t belong in class or idData can be used via JSClient-side sortingBinding/templatingBuild client-side visualisationsAnything!
  • 16. Data AttributesAny attribute beginning with data-<trdata-person-ref="1003">…</tr><trdata-sorting-key="bloggsjoe">…</tr><button data-bind="enable: SaveEnabled">…</button>Ignored by the browser and validatorsNo browser (including old ones) will be upset by thisApply to any element you want
  • 17. MultimediaNative audio and video in the browser (no plugins)<audio>OggVorbis, MP3, AAC (M4A), WAV (browser dependant)<video>WebM, Ogg (Theora + Vorbis), MP4 (H.264 + AAC)(browser dependant)
  • 18. Multimedia<audio src="music.mp3" controls>Fallback content</audio>or<audio controls> <source src="music.m4a" type="audio/mp4"> <source src="music.mp3" type="audio/mpeg">Fallback content</audio>
  • 19. CanvasA raster-based drawing surface right there in the pageManipulate via JavaScript2D currently (3D coming)Browser support: all modern browsers & IE6-8 with helpExcanvascode.google.com/p/explorercanvas/<canvas id="mycanvas" width="400" height="300">Fallback content</canvas>
  • 20. CanvasData visualisationGraphs code.google.com/p/flot/Dials/gaugesAnimation and effectsGamesRob Hawkes’ Rawketsrawkets.com
  • 21. RawketsCanvas & websockets game by Rob Hawkesrawkets.com
  • 22. CanvasGet the context for the canvas. This is what is used for drawing.var canvas = document.getElementById("mycanvas");var context = canvas.getContext("2d");or with jQuery…var canvas = $("#mycanvas").get(0);var context = canvas.getContext("2d");
  • 23. CanvasDo some drawing// Draw a couple of rectanglescontext.fillRect(x, y, w, h);context.strokeRect(x, y, w, h);// Draw a linecontext.beginPath();context.moveTo(x, y);context.lineTo(x, y);context.closePath();
  • 24. CanvasRepeat step 2Maybe do some more drawingfillRect(x, y, w, h)strokeRect(x, y, w, h)beginPath()closePath()moveTo(x, y)fill()stroke()lineTo(x, y)rect(x, y, w, h)arc(x, y, radius, startAngle, endAngle, anticlockwise)arcTo(x1, y1, x2, y2, radius)Plus a lot more
  • 25. Geo-locationFind the user’s location via JSNever happens without the user’s permissionAsks firstReturns an object:coords.latitudecoords.longitudecoords.altitudecoords.accuracycoords.altitudeAccuracycoords.headingcoords.speedtimestamp
  • 27. ResourcesStuff worth looking atDive Into HTML5diveintohtml5.orgMozilla Developer Networkdeveloper.mozilla.orgRawkes (Rob Hawkes’ Blog)rawkes.comHTML5 Logow3.org/html/logo/Stuff I’ve mentionedHTML5 Shimcode.google.com/p/html5shim/Excanvascode.google.com/p/explorercanvas/

Editor's Notes

  • #3: New elements for more accurately describing your content.New input types such as email, number, date. More on these later.Data attributes – which allow you to attach extra data to elements on your page, which can then be used from within JS.Native audio and video.Various new APIs including canvas, geolocation and offline storage (cookies on steroids).More stuff I haven’t included.Not all of these APIs are actually part of the HTML5 spec – some have been split out into their own – but they all work together as a coherent whole, and browser vendors are working in all areas.
  • #4: Just before we get to the good stuff, a couple of things… the doctype is now something that real, actual humans can remember.Presence of this is enough to put browsers into standards mode – that’s about all it does now. Doesn’t describe what the document is beyond stating it’s HTML.No browser worries here – they made sure of that.And…
  • #5: Shorthand meta syntax for describing the character encoding. Again, real people can actually remember this.
  • #6: Allows much richer description of content.hgroup = group together an h1 and h2 (for example) to be treated as heading and subheading/taglinemark = used for highlighting something.
  • #7: An example. A blog. A really rubbish blog.Let’s have a look at each part of this…
  • #8: Header and footer of the page – wrapped in the appropriately named element. Now it unambiguously states that this is the header and this is the footer. No meaningless divs.
  • #9: Menu is a list,the same as you would expectbut now enclosed in a nav element. Now we, and search engines and whatever, know it is the main navigation. Again, no ambiguity.
  • #10: A single blog post. Can be treated as a self-contained entity in itself, so belongs in an article element.Section element is similar, but is more for use when the content is only part of a whole.
  • #11: Dates &amp; times can now be marked up as such. This also opens up the possibility for them to be machine-readable (the datetime attribute). The content within the element is what’s rendered. The pubdate attribute indicates that this date/time shows the date of publication of the article – outside of an article it would apply to the page. Can only have one pubdate’d &lt;time&gt; per article/page.
  • #12: HTML5 shim adds all the new elements to the DOM in IE.old. Allows them to then be styled. Just include the JS file – conditional comments restrict it to just the IE.old versions.
  • #13: These rubbish old elements from previous specs are gone from HTML5. Browsers will no doubt still support them for some time, but that’s no excuse.
  • #14: Input types more tailored to the type of information required – e.g. mobile browsers can give a specific keyboard.Browser can present a better UI for the type of information – date, colour picker, range = slider.Opera support is best right now, Chrome and Firefox are getting there, IE = no.If an unsupported type is used, a standard text input is rendered.
  • #15: Pattern = regexMin/max = can be used with range, number etc to define upper and lower limits.Browser should show some sort of message or visual cue to indicate problems, and not allow form submission.
  • #16: Allows arbitrary pieces of data to be attached to any element.The sort of data which doesn’t belong in class or idData can be used via JS (Client-side sorting, Binding/templating, Build client-side visualisations, Anything!)
  • #17: Just add your data attributes to the appropriate elements, and do as you wish with them. Browsers will ignore them, validators won’t be the least bit upset. All browsers will be fine, including old ones.
  • #18: Audio and video are now first class citizens in the browser, just like images.Audio and video elements.A variety of codecs – support varies from browser to browser. To be sure of it working everywhere, you’ll need at least two or three versions using different formats.Modern browsers inc IE9. IE.old = no.
  • #19: Can use the src attribute (allows use of only the one format), or specify several versions using source elements. The browser will look down the list and pick one it can play. This applies to the audio and the video element.Fallback content for those browsers that don’t know about the audio/video element goes inside. Could have a message or perhaps a flash player?Demo of audio/video in the browser.
  • #20: Raster (pixel based), not vector.Draw on the canvas using JS.2D support currently, 3D coming (but not something I’ve played with at all).All modern browsers (inc IE9). Old IE emulate using excanvas, a JS lib which duplicates the canvas API.Canvas element, be sure to give width and height in markup – doing so in CSS will stretch the canvas contents. (can change these in JS of course).
  • #21: Some uses for canvas.Visualising data using graphs and dials – graph produced using a library called ‘Flot’ (jQuery plugin). Allows creation of line/scatter/bar charts. Has various other options using plugins. Dials are something I produced for work. Could be done another way but canvas is just cleaner.Can be used for animation by repeatedly drawing and clearing every so often (depending on your chosen frame rate).Rob Hawkes has based his HTML5 asteroids-type game on canvas, as have others.
  • #23: The context is the thing used for actually doing the drawing on the canvas surface. This can be got off the canvas.First get the canvas element on the page, then ask it for its 2D context.
  • #24: The context has a load of methods for drawing. fillRect = draw a filled rectanglestrokeRect = draw an outline rectangleCan draw more complex paths. Second example starts a new path, moves the start point to wherever we want it, and then draws a line. We then close the path as we’re now done. There could have been more steps.The x and y co-ordinates start at 0,0 in the top left, as you would expect.
  • #25: Can do as much drawing as you like. Here are a few methods. There are many more, such as the ability to erase areas of the canvas and change the fill and stroke colours for subsequent drawing. Note that the canvas is a bitmap, and once something is drawn it cannot be changed – you would need to erase or draw over it.
  • #26: Browser will always ask (Firefox/Chrome via an infobar, iPhone via a popup).Some of the returned object may not be included (blue ones), might be null. Other 3 are guaranteed.Accuracy = meters.Heading = degrees clockwise from north (true/magnetic north).Speed = compared to previous location/time. Given in meters per second.Modern browsers inc IE9.Timestamp = like a Date().Next side intro: W3C made a logo set for HTML5 (and associated technologies), so obviously I had no choice but to do this…
  • #27: A good team:HTML5, CSS3, JavaScript, (Semantics, Multimedia)I’ve only just briefly covered some of the new things we’re now getting, but there’s a lot more I haven’t even managed to put in here or even get a good look at. You can just use the bits you want now, and add more over time as it becomes sensible/relevant. Well worth digging in, using this as a starting-point.
  • #28: Dive into HTML5 = book by Mark Pilgrim. Paid physical version called ‘HTML5 Up an Running’ on Amazon etc.Mozilla Developer Network = lots of good stuff including HTML5, canvas and so on.Rawkes = Rob Hawkes’ site – done a lot of work around HTML5 canvas, done several talks on it.Going to put these slides and all links up on my blog in the next couple of days. Will let Matt know and tweet it.
  • #29: That’s about all.My blog, me on twitter.