SlideShare a Scribd company logo
1 of 63
Download to read offline
Advanced Web Graphics
          with canvas
               jason harwig
I hate images..
quot;In general, if I can replace an
      image with code, I do so.quot;
                         - Wil Shipley
The Triangle Story
Uselesspickles.com
A better way (without images)
                        Images       Canvas
       diff / merge   not possible   possible
      changeability      hard         easy
   client download       large        small
client render speed       fast        slow
What is Canvas?
<canvas width=quot;100quot; height=quot;100quot;>

</canvas>
ctx = canvasElement.getContext('2d')

// ctx is CanvasRenderingContext2D
included in HTML 5
browser support
Safari     2.0+

Firefox    1.5+

Opera      9.0+

  IE       N/A
show me something cool
Polar clock
mario
mario kart
algorithm ink
processing.js
Mocha UI Demo
CVI - Christian Effenberger
Color picker
what should we make?
User Interface Graphics


• Nice looking UI controls
design for programmers
Shadows and Highlights
Safari
Firefox
220, 220, 220
197, 197, 197




150, 150, 150


222, 222, 222
201, 201, 201




158, 158, 158
Specular & diffuse lighting
Border shadows
2 pixel divide
most basic shadow / highlight
specular highlights
please bare with me
watch your light source
Multiple light sources

Reflection

Visual complexity
be consistent
be subtle
canvas api
save      strokeRect      arcTo
   restore      beginPath       rect
     scale      closePath        arc
    rotate       moveTo          fill
  translate       lineTo       stroke
 transform      quadratic        clip
setTransform    CurveTo      drawImage
  clearRect       bezier    createLinearGradient

   fillRect      CurveTo     createRadialGradient
Custom UI
Rich controls
• Graphing
• Star Rating control
• Loading Spinner
• Slider
• Button on Fire
Other Ideas?

• Icons
• Password Strength Meter
• Navigation Menu / Tabs
Drawing Text
• Support in Firefox 3

For Everything else:

 • Draw Text with DOM absolutely position

 • Draw text with lines manually

     strokeText.js (CVI)
lets talk about Internet
         Explorer..
• no native support today

• no word from Microsoft on this changing
Explorer Canvas
• Adapter API, canvas to VML
• No support for:
   • globalComposition
   • radialGradients
   • drawImage with canvas
• Inserting canvas element via innerHTML
  requires document.createElement('canvas')
Browser Plugin developed by..
          Mozilla??

• Leave No Browser Behind
• ActiveX plugin that implements canvas
quot;I don't think iPhone brings anything new to
                                    the table.

It has a great user experience, but that's all.quot;
       Manjit Singh, CIO at Chiquita Brands International Inc.
Resources
quot;Triangles in CSSquot;                    quot;Processsing.jsquot;
uselesspickles.com                    ejohn.org/blog/processingjs/

quot;Polar Clockquot;                         quot;Mocha UIquot;
snipersystems.co.nz/community/        mochaui.com/demo/
polarclock/tutorial.html
                                      quot;CVIquot;
quot;JavaScript Gamesquot;                    netzgesta.de/cvi/
nihilogic.dk/labs/javascript-games/
                                      quot;Color Pickerquot;
quot;Algorithm Inkquot;                       sweetvision.com/2007/03/25/
azarask.in/projects/algorithm-ink/    enhanceing-the-javascript-color-
                                      picker-with-the-canvas-element/
More Resources
quot;Mac OS X Leopard Dockquot;            quot;No Browser Left Behindquot;
furbo.org/2007/07/03/the-hig-      blog.vlad1.com/2008/07/30/no-
still-matters-even-with-special-   browser-left-behind
effects/
                                   quot;Mozilla Canvas Tutorialquot;
quot;Navigation Menu Examplequot;          developer.mozilla.org/En/
zdotb.com                          Canvas_tutorial

quot;strokeText.jsquot;
netzgesta.de/dev/text

quot;Explorer Canvasquot;
excanvas.sourceforge.net
twitter: jharwig
jason.harwig@nearinfinity.com
    nearinfinity.com/blogs


  careers@nearinfinity.com


                               63

More Related Content

What's hot

City Mouse Mobile - A Case Study
City Mouse Mobile - A Case StudyCity Mouse Mobile - A Case Study
City Mouse Mobile - A Case StudySerge Krul
 
Inkscape: Mockup that site (BADcamp edition)
Inkscape: Mockup that site (BADcamp edition)Inkscape: Mockup that site (BADcamp edition)
Inkscape: Mockup that site (BADcamp edition)Donna Benjamin
 
[D2 오픈세미나]2.모바일웹디버깅
[D2 오픈세미나]2.모바일웹디버깅[D2 오픈세미나]2.모바일웹디버깅
[D2 오픈세미나]2.모바일웹디버깅NAVER D2
 
Inkscape: Drawing Across the Curriculum
Inkscape: Drawing Across the CurriculumInkscape: Drawing Across the Curriculum
Inkscape: Drawing Across the CurriculumDonna Benjamin
 
Mirror - Android UI development on steroids
Mirror - Android UI development on steroidsMirror - Android UI development on steroids
Mirror - Android UI development on steroidsSylwester Madej
 
Accessibility in Canvas 3D
Accessibility in Canvas 3DAccessibility in Canvas 3D
Accessibility in Canvas 3DMartin Kliehm
 
Joy of Inkscape - at StixCamp
Joy of Inkscape - at StixCampJoy of Inkscape - at StixCamp
Joy of Inkscape - at StixCampDonna Benjamin
 

What's hot (7)

City Mouse Mobile - A Case Study
City Mouse Mobile - A Case StudyCity Mouse Mobile - A Case Study
City Mouse Mobile - A Case Study
 
Inkscape: Mockup that site (BADcamp edition)
Inkscape: Mockup that site (BADcamp edition)Inkscape: Mockup that site (BADcamp edition)
Inkscape: Mockup that site (BADcamp edition)
 
[D2 오픈세미나]2.모바일웹디버깅
[D2 오픈세미나]2.모바일웹디버깅[D2 오픈세미나]2.모바일웹디버깅
[D2 오픈세미나]2.모바일웹디버깅
 
Inkscape: Drawing Across the Curriculum
Inkscape: Drawing Across the CurriculumInkscape: Drawing Across the Curriculum
Inkscape: Drawing Across the Curriculum
 
Mirror - Android UI development on steroids
Mirror - Android UI development on steroidsMirror - Android UI development on steroids
Mirror - Android UI development on steroids
 
Accessibility in Canvas 3D
Accessibility in Canvas 3DAccessibility in Canvas 3D
Accessibility in Canvas 3D
 
Joy of Inkscape - at StixCamp
Joy of Inkscape - at StixCampJoy of Inkscape - at StixCamp
Joy of Inkscape - at StixCamp
 

Similar to Advanced Web Graphics with Canvas

Academy PRO: HTML5 API graphics
Academy PRO: HTML5 API graphicsAcademy PRO: HTML5 API graphics
Academy PRO: HTML5 API graphicsBinary Studio
 
The 5 Layers of Web Accessibility
The 5 Layers of Web AccessibilityThe 5 Layers of Web Accessibility
The 5 Layers of Web AccessibilityDirk Ginader
 
Jazz up your JavaScript: Unobtrusive scripting with JavaScript libraries
Jazz up your JavaScript: Unobtrusive scripting with JavaScript librariesJazz up your JavaScript: Unobtrusive scripting with JavaScript libraries
Jazz up your JavaScript: Unobtrusive scripting with JavaScript librariesSimon Willison
 
Responsive Web Design: Clever Tips and Techniques
Responsive Web Design: Clever Tips and TechniquesResponsive Web Design: Clever Tips and Techniques
Responsive Web Design: Clever Tips and TechniquesVitaly Friedman
 
JavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureJavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureSimon Willison
 
Image video processing and canvas element by Abhay Rao
Image video processing and canvas element by Abhay RaoImage video processing and canvas element by Abhay Rao
Image video processing and canvas element by Abhay RaoMrinmay Kulkarni
 
Html5 Canvas and Mobile Graphics
Html5 Canvas and Mobile GraphicsHtml5 Canvas and Mobile Graphics
Html5 Canvas and Mobile GraphicsEngin Hatay
 
Web Apps and more
Web Apps and moreWeb Apps and more
Web Apps and moreYan Shi
 
Web app and more
Web app and moreWeb app and more
Web app and morefaming su
 
Rich Media Advertising with SVG and JavaScript
Rich Media Advertising with SVG and JavaScriptRich Media Advertising with SVG and JavaScript
Rich Media Advertising with SVG and JavaScriptGjokica Zafirovski
 
Running HTML5 Mobile Web Games at 60fps
Running HTML5 Mobile Web Games at 60fpsRunning HTML5 Mobile Web Games at 60fps
Running HTML5 Mobile Web Games at 60fpsApoorv Saxena
 
Building a Better Web with HTML5 and CSS3
Building a Better Web with HTML5 and CSS3Building a Better Web with HTML5 and CSS3
Building a Better Web with HTML5 and CSS3Karambir Singh Nain
 
[peachpit] Adaptive Images in Responsive Web Design
[peachpit] Adaptive Images in Responsive Web Design[peachpit] Adaptive Images in Responsive Web Design
[peachpit] Adaptive Images in Responsive Web DesignChristopher Schmitt
 
[D2 campus seminar]웹브라우저 엔진
[D2 campus seminar]웹브라우저 엔진[D2 campus seminar]웹브라우저 엔진
[D2 campus seminar]웹브라우저 엔진NAVER D2
 
Réaliser un jeu cross plateformes avec WebGL et babylon.js
Réaliser un jeu cross plateformes avec WebGL et babylon.jsRéaliser un jeu cross plateformes avec WebGL et babylon.js
Réaliser un jeu cross plateformes avec WebGL et babylon.jsdavrous
 
Jak tvořit hry na webu?
Jak tvořit hry na webu?Jak tvořit hry na webu?
Jak tvořit hry na webu?Pavol Hejný
 

Similar to Advanced Web Graphics with Canvas (20)

Academy PRO: HTML5 API graphics
Academy PRO: HTML5 API graphicsAcademy PRO: HTML5 API graphics
Academy PRO: HTML5 API graphics
 
The 5 Layers of Web Accessibility
The 5 Layers of Web AccessibilityThe 5 Layers of Web Accessibility
The 5 Layers of Web Accessibility
 
Jazz up your JavaScript: Unobtrusive scripting with JavaScript libraries
Jazz up your JavaScript: Unobtrusive scripting with JavaScript librariesJazz up your JavaScript: Unobtrusive scripting with JavaScript libraries
Jazz up your JavaScript: Unobtrusive scripting with JavaScript libraries
 
Responsive Web Design: Clever Tips and Techniques
Responsive Web Design: Clever Tips and TechniquesResponsive Web Design: Clever Tips and Techniques
Responsive Web Design: Clever Tips and Techniques
 
JavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureJavaScript Libraries: The Big Picture
JavaScript Libraries: The Big Picture
 
Html5 (games)
Html5 (games)Html5 (games)
Html5 (games)
 
Image video processing and canvas element by Abhay Rao
Image video processing and canvas element by Abhay RaoImage video processing and canvas element by Abhay Rao
Image video processing and canvas element by Abhay Rao
 
Html5 Canvas and Mobile Graphics
Html5 Canvas and Mobile GraphicsHtml5 Canvas and Mobile Graphics
Html5 Canvas and Mobile Graphics
 
Web Apps and more
Web Apps and moreWeb Apps and more
Web Apps and more
 
Web app and more
Web app and moreWeb app and more
Web app and more
 
Rich Media Advertising with SVG and JavaScript
Rich Media Advertising with SVG and JavaScriptRich Media Advertising with SVG and JavaScript
Rich Media Advertising with SVG and JavaScript
 
Running HTML5 Mobile Web Games at 60fps
Running HTML5 Mobile Web Games at 60fpsRunning HTML5 Mobile Web Games at 60fps
Running HTML5 Mobile Web Games at 60fps
 
Responsive Enhancement
Responsive EnhancementResponsive Enhancement
Responsive Enhancement
 
Building a Better Web with HTML5 and CSS3
Building a Better Web with HTML5 and CSS3Building a Better Web with HTML5 and CSS3
Building a Better Web with HTML5 and CSS3
 
[peachpit] Adaptive Images in Responsive Web Design
[peachpit] Adaptive Images in Responsive Web Design[peachpit] Adaptive Images in Responsive Web Design
[peachpit] Adaptive Images in Responsive Web Design
 
[D2 campus seminar]웹브라우저 엔진
[D2 campus seminar]웹브라우저 엔진[D2 campus seminar]웹브라우저 엔진
[D2 campus seminar]웹브라우저 엔진
 
Réaliser un jeu cross plateformes avec WebGL et babylon.js
Réaliser un jeu cross plateformes avec WebGL et babylon.jsRéaliser un jeu cross plateformes avec WebGL et babylon.js
Réaliser un jeu cross plateformes avec WebGL et babylon.js
 
Jak tvořit hry na webu?
Jak tvořit hry na webu?Jak tvořit hry na webu?
Jak tvořit hry na webu?
 
The Enterprise Dilemma: Native vs. Web
The Enterprise Dilemma: Native vs. WebThe Enterprise Dilemma: Native vs. Web
The Enterprise Dilemma: Native vs. Web
 
Web Vector Graphics
Web Vector GraphicsWeb Vector Graphics
Web Vector Graphics
 

Recently uploaded

Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 

Recently uploaded (20)

Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 

Advanced Web Graphics with Canvas