SlideShare una empresa de Scribd logo
1 de 15
Descargar para leer sin conexión
SVG
SVG is an XML
based vector
graphics format.
            can be part of do
                             m
<svg version="1.1"
  xmlns="http://www.w3.org/2000/svg">

  <rect x="10" y="10"
    width="30" height="30"
    stroke="black" fill="transparent"
    stroke-width="5" />

</svg>
Ca
    nva
       s

 SV
G
Retained m
                                                       ode api

 Canvas: Pixel                       SVG:
    Array                        Document Tree
immediate mode api



                use this color            <svg>
 ctx.strokeStyle = '#c66';
 ctx.lineWidth = 1;              <rect>             size: 10, 10
                                                    color: grey
 ctx.strokeRect( 0.5, 60.5,                     position: 10, 10
   150, 50);
                       e
        to draw a shap            <circle>          size: 13, 37
                                                    color: grey
                                                position: 10, 69
Canvas: Pixels   SVG: Vectors
Canvas: Only   SVG: Graphics
 in Browser       Format      t of dom,
                    can be par nvas
                        like ca
Canvas:                    SVG:
 Low Level                 High Level
+  2d performance
   high throughput
                         +  Redrawing
                            movement immediately
                            drawn


+ Draw pixels
   drawing not limited
   to primatives
                         + Interactive
                            Easy to hang listeners
                            on events


                         + Vectors
                            Resolution independent
                            scaling


                         + import/export
                            it’s a graphics
                            file format
Canvas                               SVG
<canvas id=c></canvas>            <svg version="1.1" xmlns=
                                    "http://www.w3.org/2000/svg">
<script>                            <path d="M10 10 H 90 V 90
  var c = document.                   H 10 Z"/>
    getElementsById('c');           <circle cx="10" cy="10"
  c.width = c.width;                  r="2" fill="red"/>
  var ctx = c.getContext('2d');     <circle cx="90" cy="90"
  ctx.strokeStyle = 'pink';           r="2" fill="red"/>
  ctx.lineWidth = 3;                <circle cx="90" cy="10"
  ctx.strokeRect( 10, 20,             r="2" fill="red"/>
    13, 37);                        <circle cx="10" cy="90"
</script>                             r="2" fill="red"/>
                                  </svg>
http://raphaeljs.com/analytics.html
http://croczilla.com/bits_and_pieces/svg/samples/svgtetris/svgtetris.svg
Browser
Support   66%
Summary SVG
SVG is a vector graphics document that can be used like a normal html
element. It is higher level than canvas. you define objects, attributes
and animations - redrawing is done automatically for you.
Material Used
            Banksy “Have a Break” http://www.flickr.com/photos/loungerie/4109421950/

            Banksy “Flowing off” http://www.flickr.com/photos/loungerie/4109420324/

         Banksy “They’re Coming” http://www.flickr.com/photos/97041449@N00/4115205218/

      Bansky “Tourqay Robot” http://en.wikipedia.org/wiki/File:Banksy_Torquay_robot_crop.jpg

                  Banksy “You have got to be kidding me” http://www.banksy.co.uk/

        Banksy “follow your Dream” http://www.flickr.com/photos/thomashawk/6343586111/

          Banksy “nola” http://www.flickr.com/photos/eddiedangerous/3045255243/

 Banksy “Flower Pollard Street” http://www.flickr.com/photos/eddiedangerous/1800573742/

Banksy “what are you looking at?” http://www.flickr.com/photos/nolifebeforecoffee/124659356/

   Banksy “Man and Picture of a dog” http://www.flickr.com/photos/atomicshed/141462789/

   Banksy “Anti-Capitalism for sale” http://www.flickr.com/photos/jcodysimms/246024687/
Material Used
       3d teapot model http://resumbrae.com/ub/dms423_f08/10/

 Metal Teapot http://www.flickr.com/photos/11273631@N08/2867342497/

 furry teapot http://www.flickr.com/photos/11273631@N08/2867342461/

 Television Icon http://thenounproject.com/noun/television/#icon-No416

 Graphics Card http://www.flickr.com/photos/43779660@N00/218093887/

 Banksy “under the Carpet” http://www.flickr.com/photos/acb/147223287/

  Boxing http://www.flickr.com/photos/51035655711@N01/2826228569/

Más contenido relacionado

Destacado

Destacado (6)

Introduction to D3
Introduction to D3Introduction to D3
Introduction to D3
 
Introduction to D3
Introduction to D3Introduction to D3
Introduction to D3
 
A Quick and Dirty D3.js Tutorial
A Quick and Dirty D3.js TutorialA Quick and Dirty D3.js Tutorial
A Quick and Dirty D3.js Tutorial
 
D3.js for beginners
D3.js for beginnersD3.js for beginners
D3.js for beginners
 
Dive into HTML5: SVG and Canvas
Dive into HTML5: SVG and CanvasDive into HTML5: SVG and Canvas
Dive into HTML5: SVG and Canvas
 
Introduction to data visualisations with d3.js — Data Driven Documents
Introduction to data visualisations with d3.js — Data Driven DocumentsIntroduction to data visualisations with d3.js — Data Driven Documents
Introduction to data visualisations with d3.js — Data Driven Documents
 

Similar a SVG vs Canvas - Showdown of the Painters

MOConf'13: WebNotBombs: Optimize this
MOConf'13: WebNotBombs: Optimize thisMOConf'13: WebNotBombs: Optimize this
MOConf'13: WebNotBombs: Optimize this
Boris Zapolsky
 
Interactive Graphics
Interactive GraphicsInteractive Graphics
Interactive Graphics
Blazing Cloud
 

Similar a SVG vs Canvas - Showdown of the Painters (20)

Vector Graphics on the Web: SVG, Canvas, CSS3
Vector Graphics on the Web: SVG, Canvas, CSS3Vector Graphics on the Web: SVG, Canvas, CSS3
Vector Graphics on the Web: SVG, Canvas, CSS3
 
Professional reports with SVG
Professional reports with SVGProfessional reports with SVG
Professional reports with SVG
 
Thats Not Flash?
Thats Not Flash?Thats Not Flash?
Thats Not Flash?
 
SVG - Scalable Vector Graphic
SVG - Scalable Vector GraphicSVG - Scalable Vector Graphic
SVG - Scalable Vector Graphic
 
Html5 SVG
Html5 SVGHtml5 SVG
Html5 SVG
 
MOConf'13: WebNotBombs: Optimize this
MOConf'13: WebNotBombs: Optimize thisMOConf'13: WebNotBombs: Optimize this
MOConf'13: WebNotBombs: Optimize this
 
Visualizing Data with JavaScript and Canvas
Visualizing Data with JavaScript and CanvasVisualizing Data with JavaScript and Canvas
Visualizing Data with JavaScript and Canvas
 
HTML5 Canvas - The Future of Graphics on the Web
HTML5 Canvas - The Future of Graphics on the WebHTML5 Canvas - The Future of Graphics on the Web
HTML5 Canvas - The Future of Graphics on the Web
 
Setting the Stage for SVG Animation
Setting the Stage for SVG AnimationSetting the Stage for SVG Animation
Setting the Stage for SVG Animation
 
SVG and the web
SVG and the webSVG and the web
SVG and the web
 
Advanced html5 diving into the canvas tag
Advanced html5 diving into the canvas tagAdvanced html5 diving into the canvas tag
Advanced html5 diving into the canvas tag
 
HTML5 - A Whirlwind tour
HTML5 - A Whirlwind tourHTML5 - A Whirlwind tour
HTML5 - A Whirlwind tour
 
SVG (Devoxx 2011, 2011-NOV-14)
SVG (Devoxx 2011, 2011-NOV-14)SVG (Devoxx 2011, 2011-NOV-14)
SVG (Devoxx 2011, 2011-NOV-14)
 
Drawing a Circle Three Ways: Generating Graphics for the Web
Drawing a Circle Three Ways: Generating Graphics for the WebDrawing a Circle Three Ways: Generating Graphics for the Web
Drawing a Circle Three Ways: Generating Graphics for the Web
 
Web Vector Graphics
Web Vector GraphicsWeb Vector Graphics
Web Vector Graphics
 
SVG overview
SVG overviewSVG overview
SVG overview
 
SVG (Framsia, 27-SEP-2011)
SVG (Framsia, 27-SEP-2011)SVG (Framsia, 27-SEP-2011)
SVG (Framsia, 27-SEP-2011)
 
I Can't Believe It's Not Flash
I Can't Believe It's Not FlashI Can't Believe It's Not Flash
I Can't Believe It's Not Flash
 
Interactive Graphics
Interactive GraphicsInteractive Graphics
Interactive Graphics
 
CANVAS vs SVG @ FrontInRio 2011
CANVAS vs SVG @ FrontInRio 2011CANVAS vs SVG @ FrontInRio 2011
CANVAS vs SVG @ FrontInRio 2011
 

Último

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
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
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
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...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 

SVG vs Canvas - Showdown of the Painters

  • 1. SVG
  • 2. SVG is an XML based vector graphics format. can be part of do m
  • 3. <svg version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="10" y="10" width="30" height="30" stroke="black" fill="transparent" stroke-width="5" /> </svg>
  • 4. Ca nva s SV G
  • 5. Retained m ode api Canvas: Pixel SVG: Array Document Tree immediate mode api use this color <svg> ctx.strokeStyle = '#c66'; ctx.lineWidth = 1; <rect> size: 10, 10 color: grey ctx.strokeRect( 0.5, 60.5, position: 10, 10 150, 50); e to draw a shap <circle> size: 13, 37 color: grey position: 10, 69
  • 6. Canvas: Pixels SVG: Vectors
  • 7. Canvas: Only SVG: Graphics in Browser Format t of dom, can be par nvas like ca
  • 8. Canvas: SVG: Low Level High Level + 2d performance high throughput + Redrawing movement immediately drawn + Draw pixels drawing not limited to primatives + Interactive Easy to hang listeners on events + Vectors Resolution independent scaling + import/export it’s a graphics file format
  • 9. Canvas SVG <canvas id=c></canvas> <svg version="1.1" xmlns= "http://www.w3.org/2000/svg"> <script> <path d="M10 10 H 90 V 90 var c = document. H 10 Z"/> getElementsById('c'); <circle cx="10" cy="10" c.width = c.width; r="2" fill="red"/> var ctx = c.getContext('2d'); <circle cx="90" cy="90" ctx.strokeStyle = 'pink'; r="2" fill="red"/> ctx.lineWidth = 3; <circle cx="90" cy="10" ctx.strokeRect( 10, 20, r="2" fill="red"/> 13, 37); <circle cx="10" cy="90" </script> r="2" fill="red"/> </svg>
  • 13. Summary SVG SVG is a vector graphics document that can be used like a normal html element. It is higher level than canvas. you define objects, attributes and animations - redrawing is done automatically for you.
  • 14. Material Used Banksy “Have a Break” http://www.flickr.com/photos/loungerie/4109421950/ Banksy “Flowing off” http://www.flickr.com/photos/loungerie/4109420324/ Banksy “They’re Coming” http://www.flickr.com/photos/97041449@N00/4115205218/ Bansky “Tourqay Robot” http://en.wikipedia.org/wiki/File:Banksy_Torquay_robot_crop.jpg Banksy “You have got to be kidding me” http://www.banksy.co.uk/ Banksy “follow your Dream” http://www.flickr.com/photos/thomashawk/6343586111/ Banksy “nola” http://www.flickr.com/photos/eddiedangerous/3045255243/ Banksy “Flower Pollard Street” http://www.flickr.com/photos/eddiedangerous/1800573742/ Banksy “what are you looking at?” http://www.flickr.com/photos/nolifebeforecoffee/124659356/ Banksy “Man and Picture of a dog” http://www.flickr.com/photos/atomicshed/141462789/ Banksy “Anti-Capitalism for sale” http://www.flickr.com/photos/jcodysimms/246024687/
  • 15. Material Used 3d teapot model http://resumbrae.com/ub/dms423_f08/10/ Metal Teapot http://www.flickr.com/photos/11273631@N08/2867342497/ furry teapot http://www.flickr.com/photos/11273631@N08/2867342461/ Television Icon http://thenounproject.com/noun/television/#icon-No416 Graphics Card http://www.flickr.com/photos/43779660@N00/218093887/ Banksy “under the Carpet” http://www.flickr.com/photos/acb/147223287/ Boxing http://www.flickr.com/photos/51035655711@N01/2826228569/