SlideShare uma empresa Scribd logo
1 de 39
Baixar para ler offline
RAPHAËL AND YOU
    Trotter Cashion
   RubyNation 2011
THIS IS ON THE INTERNET!
•Slideshare - http://www.slideshare.net/trotter/raphal-rubynation
•My Bloggy Blog - http://trottercashion.com
IT’S ME!
CO-FOUNDER



 http://mashion.net
@CASHION




   http://www.charlesheflin.com/wp-content/uploads/2010/06/fail-whale.jpg
github.com/trotter




                     http://gems.github.com/octocat.png
RAPHAËL’S DAD
http://dmitry.baranovskiy.com/




                                 http://www.flickr.com/photos/lachlanhardy/435025107/in/photostream/
COMES FROM A LAND DOWN UNDER




            http://images.coveralia.com/audio/m/Men_At_Work-Super_Hits-Frontal.jpg
SENCHA




 http://www.blackbambu.com/wp-content/uploads/2011/02/sencha-logo.png
“RAPHAËL IS A SMALL JAVASCRIPT
LIBRARY THAT SHOULD SIMPLIFY
   YOUR WORK WITH VECTOR
    GRAPHICS ON THE WEB.”




                          http://raphaeljs.com/
“SCALABLE VECTOR GRAPHICS
       (SVG) IS A FAMILY OF
SPECIFICATIONS OF AN XML-BASED
FILE FORMAT FOR DESCRIBING TWO-
  DIMENSIONAL VECTOR GRAPHICS,
    BOTH STATIC AND DYNAMIC.”



                  http://en.wikipedia.org/wiki/Scalable_Vector_Graphics
“VECTOR MARKUP LANGUAGE
(VML) IS A DEPRECATED XML
LANGUAGE USED TO PRODUCE
    VECTOR GRAPHICS.”




                    http://en.wikipedia.org/wiki/VML
VECTOR GRAPHICS
SVG             VML




            Throws never ending
             deprecation parties.
SMALL - 60KB*
120


 90


 60


 30


  0
      Socket.IO     Raphaël     jQuery   YUI


                   * 20Kb with GZIP
SIMPLE
r = Raphael("somediv", 100, 100);
rect = r.rect(20, 20, 50, 50);

setInterval(function () {
  rect.rotate(1);
}, 10);
THE COMPETITION




  The Canvas Part
FOR YOUR MANAGER

                Raphaël   Canvas   Flash
Tiny Download     x         x
     Fast         x         x        ?
    Open          x         x
 All Browsers     x                 x
   Mobile          ?        x
   Shapes         x                 x
Everything is a
 node and can
 be treated like
a normal DOM
    element.



                   http://www.comicvsaudience.net/images/dom.jpg
Yes... this means binding with
      jQuery is fair game.
RAPHAËL
EXAMPLE TIME!




    http://fc07.deviantart.net/fs71/f/2010/363/4/e/peanut_butter_jelly_time_8dddd_by_mariomario54321-d35zla9.png
NEW YORK TIMES
RECTANGLES, HOW DO THEY WORK?
       r = Raphael("jobs-graph", 640, 120);

       rect = r.rect(481, 30, 7, 90);
       rect.attr({stroke: "none",
                  fill:   "#446093"});


   This one
TEXT, HOW DO THEY WORK?

     r = Raphael("jobs-graph", 640, 140);

     text = r.text(490, 130, "CLINTON");
     text.attr({font: "8px Courier",
                fill: "#9c9c9b"});

 Hi Bill!
THE INVISIBLE HOVER
  hover = r.rect(481, 0, 8, 120);
  hover.attr({stroke: "none",
              "fill": "#fff",
              "fill-opacity": 0});

  $(hover.node).hover(function () {
    rect.attr({"stroke": "#000"});
  }, function () {
    rect.attr({"stroke": "none"});
  });

 Only the black line for now
EXPECT A BLOG POST ON
            CALLOUTS
              http://trottercashion.com




The Callout
WALL STREET JOURNAL
STATES ARE PATHS
r = Raphael("usa", 637, 432);
path = r.path(
"M352,226L401,224L403,227L399,232L407,231L408,233L40
4,235L406,236L405,237L405,238L404,238L404,240L403,23
9L402,240L403,240L402,242L404,244L401,246L401,248L39
9,248L400,250L399,249L398,250L399,251L398,251L398,25
5L397,256L396,256L395,258L394,257L396,259L394,259L39
5,260L394,262L393,261L394,264L392,265L394,266L391,26
6L392,267L391,267L391,269L393,269L392,270L393,269L39
2,270L393,272L394,271L393,273L392,274L392,275L358,27
6L358,269L354,269L353,268L353,242L350,226L352,226Z"
);
path.attr({fill: "#3081c2",
           stroke: "#828282"});
STATES ARE PATHS

 r = Raphael("usa", 637, 432);
 path = r.path(
    "M352,226 L401,224 L403,227 Z"
 );
 path.attr({fill:    "#3081c2",
            stroke: "#828282"});

I grew up here!
MAKE IT BIGGER!*

path.animate({scale: [2, 2]},
             1000);




            *WSJ actually does much more crazy than this
NISSAN
IMAGES, HOW DO THEY WORK?
             r = Raphael("nissan", 1264, 568);
             r.image(
                "/images/learn/nodes/6/6i1.png",
                672,
                301,
                48,
                48
             );


  This one
THE IMAGE FROM BEFORE...

             circle.attr({
               fill: "270-#58a0ff-#5fe2fe",
               stroke: "none"
             });




This could have
 been a circle!
CIRCLES, HOW DO THEY WORK?

           circle = r.circle(213, 244, 5);
           circle.attr({stroke: "#a2c9e3",
                        "stroke-width":    4,
                        "stroke-opacity": 0.6});




      Transparency
       for teh win!
HOW DO WE FIX THE LINE?

          rad      =30 * Math.PI / 180;
          startX   =Math.cos(rad) * 7 + 213;
          startY   =Math.sin(rad) * 7 + 244;
          path     =["M", startX, startY,
                     "l 300,100"];
          r.path(path);

     Transparency
     reveals we lose!
WHIPLASH!*

    circle.click(function () {
      circle.animate({cx: 513,
                      cy: 344},
                     1000,
                     "elastic");
    });




        *Nissan actually swaps the circle out for an
     animated gif, which is then animated w/ Raphaël.
RAPHAËL LINKS

•Raphaël - http://raphaeljs.com
•Testing - http://bit.ly/raphael-testing
•More this month... - http://trottercashion.com
EXAMPLE SITES

•New York Times - http://nyti.ms/eoxtC6
•Wall Street Journal - http://on.wsj.com/hMsmqW
•Nissan - http://bit.ly/fJ2zPb
THANK YOU!

Mais conteúdo relacionado

Mais procurados

An Introduction to Tinkerpop
An Introduction to TinkerpopAn Introduction to Tinkerpop
An Introduction to Tinkerpop
Takahiro Inoue
 

Mais procurados (11)

Dion Almaer & Ben Galbraith - Build Once, Deploy Everywhere
Dion Almaer & Ben Galbraith - Build Once, Deploy EverywhereDion Almaer & Ben Galbraith - Build Once, Deploy Everywhere
Dion Almaer & Ben Galbraith - Build Once, Deploy Everywhere
 
2.3 implicits
2.3 implicits2.3 implicits
2.3 implicits
 
I like Trains - MRMCD15
I like Trains - MRMCD15I like Trains - MRMCD15
I like Trains - MRMCD15
 
SLIME
SLIMESLIME
SLIME
 
Pattern matching in Elixir by example - Alexander Khokhlov
Pattern matching in Elixir by example - Alexander KhokhlovPattern matching in Elixir by example - Alexander Khokhlov
Pattern matching in Elixir by example - Alexander Khokhlov
 
Graphical representation of Stack
Graphical representation of StackGraphical representation of Stack
Graphical representation of Stack
 
An Introduction to Tinkerpop
An Introduction to TinkerpopAn Introduction to Tinkerpop
An Introduction to Tinkerpop
 
Es84
Es84Es84
Es84
 
GCD in Action
GCD in ActionGCD in Action
GCD in Action
 
Kwp2 100114
Kwp2 100114Kwp2 100114
Kwp2 100114
 
Zebra
ZebraZebra
Zebra
 

Destaque

Workshop Holocaust Education In The 21st Century
Workshop  Holocaust Education In The 21st CenturyWorkshop  Holocaust Education In The 21st Century
Workshop Holocaust Education In The 21st Century
Rich Gair
 
Why history
Why historyWhy history
Why history
ochoa1jf
 
Holocaust Museum Sample
Holocaust Museum SampleHolocaust Museum Sample
Holocaust Museum Sample
David Mann
 
Bringing Together Levels of Expertise
Bringing Together Levels of ExpertiseBringing Together Levels of Expertise
Bringing Together Levels of Expertise
Shartman64
 
Step by step tia davison
Step by step tia davisonStep by step tia davison
Step by step tia davison
ttcandy
 
Jewish after holocaust
Jewish after holocaustJewish after holocaust
Jewish after holocaust
msanchez849
 
Candice Teachers As Part Of Community
Candice    Teachers As Part Of CommunityCandice    Teachers As Part Of Community
Candice Teachers As Part Of Community
Kevin Hodgson
 

Destaque (20)

Mr pedro alejandrino rodriguez united states of america
Mr pedro alejandrino rodriguez united states of americaMr pedro alejandrino rodriguez united states of america
Mr pedro alejandrino rodriguez united states of america
 
Observation task arsenal museum draft
Observation task arsenal museum draftObservation task arsenal museum draft
Observation task arsenal museum draft
 
Workshop Holocaust Education In The 21st Century
Workshop  Holocaust Education In The 21st CenturyWorkshop  Holocaust Education In The 21st Century
Workshop Holocaust Education In The 21st Century
 
Genocide
GenocideGenocide
Genocide
 
The Holocaust Museum
The Holocaust MuseumThe Holocaust Museum
The Holocaust Museum
 
Confronting Hatred in the Social Media Age
Confronting Hatred in the Social Media AgeConfronting Hatred in the Social Media Age
Confronting Hatred in the Social Media Age
 
Holocaust
HolocaustHolocaust
Holocaust
 
Why history
Why historyWhy history
Why history
 
Vacatures zomer 2011
Vacatures zomer 2011Vacatures zomer 2011
Vacatures zomer 2011
 
History is merely a list of surprises
History is merely a list of surprisesHistory is merely a list of surprises
History is merely a list of surprises
 
4 holocaust
4 holocaust4 holocaust
4 holocaust
 
Holocaust Museum Sample
Holocaust Museum SampleHolocaust Museum Sample
Holocaust Museum Sample
 
Bringing Together Levels of Expertise
Bringing Together Levels of ExpertiseBringing Together Levels of Expertise
Bringing Together Levels of Expertise
 
Remembering
RememberingRemembering
Remembering
 
Step by step tia davison
Step by step tia davisonStep by step tia davison
Step by step tia davison
 
Polish Victims of the Holocaust (This one!)
Polish Victims of the Holocaust (This one!)Polish Victims of the Holocaust (This one!)
Polish Victims of the Holocaust (This one!)
 
Why Museums Matter (Tourism Educators Conference)
Why Museums Matter (Tourism Educators Conference)Why Museums Matter (Tourism Educators Conference)
Why Museums Matter (Tourism Educators Conference)
 
Australia day 1938
Australia day 1938Australia day 1938
Australia day 1938
 
Jewish after holocaust
Jewish after holocaustJewish after holocaust
Jewish after holocaust
 
Candice Teachers As Part Of Community
Candice    Teachers As Part Of CommunityCandice    Teachers As Part Of Community
Candice Teachers As Part Of Community
 

Semelhante a Raphaël and You

[A5]deview 2012 pt hds webkit_gpu
[A5]deview 2012 pt hds webkit_gpu[A5]deview 2012 pt hds webkit_gpu
[A5]deview 2012 pt hds webkit_gpu
NAVER D2
 
Tecnicas avanzadas con CSS3
Tecnicas avanzadas con CSS3Tecnicas avanzadas con CSS3
Tecnicas avanzadas con CSS3
Marta Armada
 
How to build a html5 websites.v1
How to build a html5 websites.v1How to build a html5 websites.v1
How to build a html5 websites.v1
Bitla Software
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
Dmitry Buzdin
 

Semelhante a Raphaël and You (20)

[A5]deview 2012 pt hds webkit_gpu
[A5]deview 2012 pt hds webkit_gpu[A5]deview 2012 pt hds webkit_gpu
[A5]deview 2012 pt hds webkit_gpu
 
Tecnicas avanzadas con CSS3
Tecnicas avanzadas con CSS3Tecnicas avanzadas con CSS3
Tecnicas avanzadas con CSS3
 
Rendering Art on the Web - A Performance compendium
Rendering Art on the Web - A Performance compendiumRendering Art on the Web - A Performance compendium
Rendering Art on the Web - A Performance compendium
 
Standards.Next: Canvas
Standards.Next: CanvasStandards.Next: Canvas
Standards.Next: Canvas
 
The Code
The CodeThe Code
The Code
 
How to build a html5 websites.v1
How to build a html5 websites.v1How to build a html5 websites.v1
How to build a html5 websites.v1
 
[SI] Ada Lovelace Day 2014 - Tampon Run
[SI] Ada Lovelace Day 2014  - Tampon Run[SI] Ada Lovelace Day 2014  - Tampon Run
[SI] Ada Lovelace Day 2014 - Tampon Run
 
Raphaël
RaphaëlRaphaël
Raphaël
 
Painless visual testing
Painless visual testingPainless visual testing
Painless visual testing
 
JSinSA - JS Visualisation APIs
JSinSA - JS Visualisation APIsJSinSA - JS Visualisation APIs
JSinSA - JS Visualisation APIs
 
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
 
When Bad Things Come In Good Packages
When Bad Things Come In Good PackagesWhen Bad Things Come In Good Packages
When Bad Things Come In Good Packages
 
Emerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the HorizonEmerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the Horizon
 
Ruby on Rails 3.1: Let's bring the fun back into web programing
Ruby on Rails 3.1: Let's bring the fun back into web programingRuby on Rails 3.1: Let's bring the fun back into web programing
Ruby on Rails 3.1: Let's bring the fun back into web programing
 
Google's HTML5 Work: what's next?
Google's HTML5 Work: what's next?Google's HTML5 Work: what's next?
Google's HTML5 Work: what's next?
 
Introduction to Coding
Introduction to CodingIntroduction to Coding
Introduction to Coding
 
JavaOne 2009 - 2d Vector Graphics in the browser with Canvas and SVG
JavaOne 2009 -  2d Vector Graphics in the browser with Canvas and SVGJavaOne 2009 -  2d Vector Graphics in the browser with Canvas and SVG
JavaOne 2009 - 2d Vector Graphics in the browser with Canvas and SVG
 
[EN] Ada Lovelace Day 2014 - Tampon run
[EN] Ada Lovelace Day 2014  - Tampon run[EN] Ada Lovelace Day 2014  - Tampon run
[EN] Ada Lovelace Day 2014 - Tampon run
 
Ricky Bobby's World
Ricky Bobby's WorldRicky Bobby's World
Ricky Bobby's World
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
 

Último

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
 
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
 
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
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Último (20)

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
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
 
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
 
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...
 
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
 
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
 
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
 
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
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
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
 
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
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
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 ...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
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
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 

Raphaël and You

  • 1. RAPHAËL AND YOU Trotter Cashion RubyNation 2011
  • 2. THIS IS ON THE INTERNET! •Slideshare - http://www.slideshare.net/trotter/raphal-rubynation •My Bloggy Blog - http://trottercashion.com
  • 5. @CASHION http://www.charlesheflin.com/wp-content/uploads/2010/06/fail-whale.jpg
  • 6. github.com/trotter http://gems.github.com/octocat.png
  • 7.
  • 8. RAPHAËL’S DAD http://dmitry.baranovskiy.com/ http://www.flickr.com/photos/lachlanhardy/435025107/in/photostream/
  • 9. COMES FROM A LAND DOWN UNDER http://images.coveralia.com/audio/m/Men_At_Work-Super_Hits-Frontal.jpg
  • 11. “RAPHAËL IS A SMALL JAVASCRIPT LIBRARY THAT SHOULD SIMPLIFY YOUR WORK WITH VECTOR GRAPHICS ON THE WEB.” http://raphaeljs.com/
  • 12. “SCALABLE VECTOR GRAPHICS (SVG) IS A FAMILY OF SPECIFICATIONS OF AN XML-BASED FILE FORMAT FOR DESCRIBING TWO- DIMENSIONAL VECTOR GRAPHICS, BOTH STATIC AND DYNAMIC.” http://en.wikipedia.org/wiki/Scalable_Vector_Graphics
  • 13. “VECTOR MARKUP LANGUAGE (VML) IS A DEPRECATED XML LANGUAGE USED TO PRODUCE VECTOR GRAPHICS.” http://en.wikipedia.org/wiki/VML
  • 14. VECTOR GRAPHICS SVG VML Throws never ending deprecation parties.
  • 15. SMALL - 60KB* 120 90 60 30 0 Socket.IO Raphaël jQuery YUI * 20Kb with GZIP
  • 16. SIMPLE r = Raphael("somediv", 100, 100); rect = r.rect(20, 20, 50, 50); setInterval(function () { rect.rotate(1); }, 10);
  • 17. THE COMPETITION The Canvas Part
  • 18. FOR YOUR MANAGER Raphaël Canvas Flash Tiny Download x x Fast x x ? Open x x All Browsers x x Mobile ? x Shapes x x
  • 19. Everything is a node and can be treated like a normal DOM element. http://www.comicvsaudience.net/images/dom.jpg
  • 20. Yes... this means binding with jQuery is fair game.
  • 21. RAPHAËL EXAMPLE TIME! http://fc07.deviantart.net/fs71/f/2010/363/4/e/peanut_butter_jelly_time_8dddd_by_mariomario54321-d35zla9.png
  • 23. RECTANGLES, HOW DO THEY WORK? r = Raphael("jobs-graph", 640, 120); rect = r.rect(481, 30, 7, 90); rect.attr({stroke: "none",            fill: "#446093"}); This one
  • 24. TEXT, HOW DO THEY WORK? r = Raphael("jobs-graph", 640, 140); text = r.text(490, 130, "CLINTON"); text.attr({font: "8px Courier",            fill: "#9c9c9b"}); Hi Bill!
  • 25. THE INVISIBLE HOVER hover = r.rect(481, 0, 8, 120); hover.attr({stroke: "none",             "fill": "#fff",             "fill-opacity": 0}); $(hover.node).hover(function () {   rect.attr({"stroke": "#000"}); }, function () {   rect.attr({"stroke": "none"}); }); Only the black line for now
  • 26. EXPECT A BLOG POST ON CALLOUTS http://trottercashion.com The Callout
  • 28. STATES ARE PATHS r = Raphael("usa", 637, 432); path = r.path( "M352,226L401,224L403,227L399,232L407,231L408,233L40 4,235L406,236L405,237L405,238L404,238L404,240L403,23 9L402,240L403,240L402,242L404,244L401,246L401,248L39 9,248L400,250L399,249L398,250L399,251L398,251L398,25 5L397,256L396,256L395,258L394,257L396,259L394,259L39 5,260L394,262L393,261L394,264L392,265L394,266L391,26 6L392,267L391,267L391,269L393,269L392,270L393,269L39 2,270L393,272L394,271L393,273L392,274L392,275L358,27 6L358,269L354,269L353,268L353,242L350,226L352,226Z" ); path.attr({fill: "#3081c2",            stroke: "#828282"});
  • 29. STATES ARE PATHS r = Raphael("usa", 637, 432); path = r.path( "M352,226 L401,224 L403,227 Z" ); path.attr({fill: "#3081c2",            stroke: "#828282"}); I grew up here!
  • 30. MAKE IT BIGGER!* path.animate({scale: [2, 2]}, 1000); *WSJ actually does much more crazy than this
  • 32. IMAGES, HOW DO THEY WORK? r = Raphael("nissan", 1264, 568); r.image( "/images/learn/nodes/6/6i1.png", 672, 301, 48, 48 ); This one
  • 33. THE IMAGE FROM BEFORE... circle.attr({ fill: "270-#58a0ff-#5fe2fe",   stroke: "none" }); This could have been a circle!
  • 34. CIRCLES, HOW DO THEY WORK? circle = r.circle(213, 244, 5); circle.attr({stroke: "#a2c9e3",              "stroke-width": 4,              "stroke-opacity": 0.6}); Transparency for teh win!
  • 35. HOW DO WE FIX THE LINE? rad =30 * Math.PI / 180; startX =Math.cos(rad) * 7 + 213; startY =Math.sin(rad) * 7 + 244; path =["M", startX, startY, "l 300,100"]; r.path(path); Transparency reveals we lose!
  • 36. WHIPLASH!* circle.click(function () {   circle.animate({cx: 513,                   cy: 344},                  1000,                  "elastic"); }); *Nissan actually swaps the circle out for an animated gif, which is then animated w/ Raphaël.
  • 37. RAPHAËL LINKS •Raphaël - http://raphaeljs.com •Testing - http://bit.ly/raphael-testing •More this month... - http://trottercashion.com
  • 38. EXAMPLE SITES •New York Times - http://nyti.ms/eoxtC6 •Wall Street Journal - http://on.wsj.com/hMsmqW •Nissan - http://bit.ly/fJ2zPb