Dmitry Baranovskiy Talks about Raphaël

Share this article

Dmitry is the author of the amazing Raphaël JavaScript library, which I discussed back in Tech Times #205. At Web Directions South, I managed to catch his presentation and chat about how Raphaël came about.

SitePoint: Right, I thought my first question should be: why did you write Raphaël? What inspired you to write it?

I was doing a FedEx project. Internally at Atlassian, we have FedEx Days when you are given the time to present a project you’ve been working on.

SP: FedEx Day–did you say?

It’s called “FedEx” because you have to deliver something cool. You show it off at a small competition (it’s not about big prizes–it’s more for fun), and of course it should be related to the projects you work on. Because I’m a front end engineer and all the other guys are Java developers, I thought I’d focus on a front end project that will impress people. It’s hard to impress back end developers.

So I thought I’d do something the programmers might not know anything about, and because I’ve had experience with SVG before, it made sense to work with SVG. But, as a front end developer, I’m concerned about creating something that only works in Firefox, so I wanted to create a bridge for VML on IE. My original project was to create a charting application, like a simple line chart. I quickly knocked it up in a day and a half from scratch, showed it, but it didn’t win anything. It didn’t impress people.

SP: Not even a little bit?

Oh, maybe a little bit, but not in general. So I left it for a while. Then we started our 20% projects (just like Google). I decided to pick up this project and extend it a little bit. I got rid of the charting part and turned it into a generic drawing library. Just a bridge between SVG and VML to enable me to do more cool stuff without worrying about browser compatibility.

So at the next FedEx Day, I used this library to create a Skitch-like application. You could take a picture and add things like arrows and ellipses. It even saved the image, but obviously that’s not the hardest part.

Then I started working more on this 20% project. To be honest, I spent more than one day a week: I worked with my laptop on the train — one hour to work and one hour back — two days a week in general, for about a month. Then I decided that it was good enough to release, because it’s better to do so before another developer releases the same thing. So, I released it in the middle of August.

I was stunned by the feedback. I didn’t expect it, to be honest, because I wrote about it on my blog and I usually get about 20 hits per day; but after it was released and made it to the front page of Delicious and Reddit, I got about 8,000 hits per day. It chewed through my bandwidth and I had to create a new domain. It actually started costing me money!

SP: So do you actually use it in your job at Atlassian?

Not yet, but we have plans to integrate it into products for charting and so on, but we haven’t found many use cases for it so far. I Personally think people are a bit afraid of the technology. But I hope it will find a place. It’s still quite raw. So it’s enough to show the concept, have fun, and do some stuff here and there. I’m always finding bugs (especially bugs for IE), so it’s not really, absolutely ready. Well, it’s only one month old.

SP: Where would you like to see it used?

Oh, well, everywhere. World domination is my goal! Of course the first thing people think of is charting, and that’s how I came to this idea, but what I was trying to show was that charting is just one obvious part. You could use it to add effects to a page, like the rotation of an image.

Say, if you’re on Flickr and you want to rotate an image by 90 degrees because you’ve shot the photo on the side. Currently, you press a button, it sends the request to the server, the server does the rotation, sends it back, and you see the rotated picture. Instead, you could use Ajax to just send the basic information: rotate 90% to the right, and on the client you’d have a smooth animation of rotating to the right. That would be a much more pleasant experience to the user for obvious reasons.

It’d be cool, and it’s really easy to implement using Raphaël. Without it, it’s a bit complicated to implement because you have to do a the IE version separately from the version for all other browsers. Actually that’s the whole reason why I built Raphaël — you do something in FireFox and in IE it just works. It’s not absolutely there yet, but it’s getting there.

SP: When I was doing my demo I did notice one snag. In all the non-IE browsers you could do a path, then avoid specifing a fill color, and it would just draw the line. But in IE if you didn’t specify a fill color it would choose white, and it would start attempting to fill in the white.

Yeah, I fixed it.

SP: Oh really? Oh good, fantastic. Because I resorted to setting the fill opacity to 0.

Yeah I noticed it when I looked at the code I thought “Oh, why did you use opacity for the fill?” So I started playing around and thought “Ah yeah, oh, ok.”

SP: Hey thanks!

Yeah, I often find bugs when I test in IE. SVG and VML are absolutely different languages. You can’t really replace one with the other. Sometimes it’s just impossible to do something in IE that’s easy to do in SVG. So I have to find a compromise solution. I can’t have an API for something you can’t do.

For example, in SVG you can rotate an object around a point, while in IE rotation is very wonky; you can’t specify the point. It rotates around some magical center and this center point is very randomly located in the center of… well I don’t know what it’s the center of. I found if you put the object inside a group it will be the center of the group, and it would do some juggling of the objects and they’d be jumping around the place. So I’ve succeeded in getting all the objects to rotate around their centers in all the implementations, but people ask me if they can specify the point of rotation. I say “Oh yeah, I wish.” So, not yet, but maybe later. I wish to do it, but it’s not that easy to do. In SVG it’s easy; it’s built in. But in VML it’s not.

SP: I thought it was maybe a weakness but also a strength of Raphaël, that if you approach the task thinking about how you can doing it using the Raphaël API then you avoid those kinds of problems.

Well maybe, sort of… Well for example I was trying to implement a blur effect and you can do it in Explorer, Firefox, and Opera, but Safari doesn’t support it, surprisingly. As soon as I discover I can’t do something across all browsers I don’t add it to the API. As soon as Safari supports it I’ll put it in. But for now there’s no point because the whole point of Raphaël is that you write it and it just works. Well, I hope it will. In version 1 it should be like that.

It could also help you to understand, you know, if you try to do something and you say “Could I do this cross-browser?” The answer may well be “No.” Of course, when I was creating Raphaël I was trying to cover as much functionality as possible, so if I removed something I removed it for reason. Maybe I’ll find a way to do it later, maybe there’s no way to do it in Internet Explorer.

Sometimes I do some extra calculations in SVG to emulate IE functionality. If I have a choice I’ll probably add the extra calculation into the SVG side because the JavaScript engines are faster in browsers other than IE. If you have to compromise and do a calculation in IE or do a calculation in Firefox, for example, it’s better to do the calculation in Firefox, it will be faster, and the user wont notice. If you do it in IE, it will be slower, and IE users will be upset.

SP: I was talking to some of the developers at SitePoint and a few of us agreed that, down the track, using SVG and VML driven by JavaScript could easily replace Flash.

I wouldn’t say easily. There are some things that Flash is good at, like streaming video and animations. But if you look at, for example, the Google Analytics charts, then I can’t see any reason why it can’t be done with Raphaël.

Yesterday morning I was trying to reproduce the Google charts functionality. I did it on the train; it’s really easy to do, and it works cross-browser straight away. Of course, to do this you need a JavaScript developer in your team who will use a program like Raphaël, or as I mentioned in my talk, excanvas, or dojox. To be honest, I think that Raphaël has the more correct approach. It’s probably not as well-developed yet, but those other libraries don’t approach the usage correctly. They mix canvas, SVG, and VML together, and canvas is completely different. SVG and VML are ideologically the same. Well, to some extent, I guess.

I don’t think it will replace Flash, but if in some task you could use SVG instead of Flash, I’d be happy to see that. Something native, something you can hack–the whole concept of the open web. SVG, and even VML, is more open than Flash. You can hack it up, you can view source, whatever. And, of course, Flash doesn’t work on iPhone. That’s another reason for doing this using native browser technologies. I’m not talking about Raphaël specifically; I think SVG is the way to go for a lot of things.

SP: The issue of accessibility comes up a lot in regards to Raphaël, although when I look at your demos you tend to stick to the ideal of unobtrusive JavaScript anyway.

When you talk about images and charts–and whatever SVG produces, it’s always an image, dynamic or not–it’s always an accessibility issue. At my talk, we spoke about how a screen reader should read SVG; how they should read circles, and ellipses, and combinations of them. Even if you had a good parser that could read the shapes you create on the page, you couldn’t tell what the shapes actually create: the final image. It’s really complicated and very difficult to explain if the user is blind. Like how would you explain the Web Directions logo to a blind user? I don’t think screen readers will ever be able to do this.

So it’s all up to the developer to do it properly. For example, in the case of my charts, I have a table on the page. A screen reader can see that table, and if you have JavaScript turned off, you can see the table. You still have access to the data; it’s not as pretty, not as visually rich, but you can still read it and understand.

I don’t think it’s a problem with SVG, or a problem with Raphaël; I think it’s a generic problem and there are already many articles and books about how to deal with it.

SP: Well thank you very much, really good to talk to you

No worries.

Andrew TetlawAndrew Tetlaw
View Author

iOS Developer, sometimes web developer and Technical Editor.

Share this article
Read Next
From Idea to Prototype in Minutes: Claude Sonnet 3.5
From Idea to Prototype in Minutes: Claude Sonnet 3.5
Zain
Essential Plugins for WordPress Developers: Top Picks for 2024
Essential Plugins for WordPress Developers: Top Picks for 2024
SitePoint Sponsors
WebAssembly vs JavaScript: A Comparison
WebAssembly vs JavaScript: A Comparison
Kaan Güner
The Functional Depth of Docker and Docker Compose
The Functional Depth of Docker and Docker Compose
Vultr
How Top HR Agencies Build Trust Through Logo Designs
How Top HR Agencies Build Trust Through Logo Designs
Evan Brown
Leveraging Progressive Web Apps (PWAs) for Enhanced Mobile User Engagement
Leveraging Progressive Web Apps (PWAs) for Enhanced Mobile User Engagement
SitePoint Sponsors
10 Artificial Intelligence APIs for Developers
10 Artificial Intelligence APIs for Developers
SitePoint Sponsors
The Ultimate Guide to Navigating SQL Server With SQLCMD
The Ultimate Guide to Navigating SQL Server With SQLCMD
Nisarg Upadhyay
Retrieval-augmented Generation: Revolution or Overpromise?
Retrieval-augmented Generation: Revolution or Overpromise?
Kateryna ReshetiloOlexandr Moklyak
How to Deploy Apache Airflow on Vultr Using Anaconda
How to Deploy Apache Airflow on Vultr Using Anaconda
Vultr
Cloud Native: How Ampere Is Improving Nightly Arm64 Builds
Cloud Native: How Ampere Is Improving Nightly Arm64 Builds
Dave NearyAaron Williams
How to Create Content in WordPress with AI
How to Create Content in WordPress with AI
Çağdaş Dağ
A Beginner’s Guide to Setting Up a Project in Laravel
A Beginner’s Guide to Setting Up a Project in Laravel
Claudio Ribeiro
Enhancing DevSecOps Workflows with Generative AI: A Comprehensive Guide
Enhancing DevSecOps Workflows with Generative AI: A Comprehensive Guide
Gitlab
Creating Fluid Typography with the CSS clamp() Function
Creating Fluid Typography with the CSS clamp() Function
Daine Mawer
Comparing Full Stack and Headless CMS Platforms
Comparing Full Stack and Headless CMS Platforms
Vultr
7 Easy Ways to Make a Magento 2 Website Faster
7 Easy Ways to Make a Magento 2 Website Faster
Konstantin Gerasimov
Powerful React Form Builders to Consider in 2024
Powerful React Form Builders to Consider in 2024
Femi Akinyemi
Quick Tip: How to Animate Text Gradients and Patterns in CSS
Quick Tip: How to Animate Text Gradients and Patterns in CSS
Ralph Mason
Sending Email Using Node.js
Sending Email Using Node.js
Craig Buckler
Creating a Navbar in React
Creating a Navbar in React
Vidura Senevirathne
A Complete Guide to CSS Logical Properties, with Cheat Sheet
A Complete Guide to CSS Logical Properties, with Cheat Sheet
Ralph Mason
Using JSON Web Tokens with Node.js
Using JSON Web Tokens with Node.js
Lakindu Hewawasam
How to Build a Simple Web Server with Node.js
How to Build a Simple Web Server with Node.js
Chameera Dulanga
Building a Digital Fortress: How to Strengthen DNS Against DDoS Attacks?
Building a Digital Fortress: How to Strengthen DNS Against DDoS Attacks?
Beloslava Petrova
Crafting Interactive Scatter Plots with Plotly
Crafting Interactive Scatter Plots with Plotly
Binara Prabhanga
GenAI: How to Reduce Cost with Prompt Compression Techniques
GenAI: How to Reduce Cost with Prompt Compression Techniques
Suvoraj Biswas
How to Use jQuery’s ajax() Function for Asynchronous HTTP Requests
How to Use jQuery’s ajax() Function for Asynchronous HTTP Requests
Aurelio De RosaMaria Antonietta Perna
Quick Tip: How to Align Column Rows with CSS Subgrid
Quick Tip: How to Align Column Rows with CSS Subgrid
Ralph Mason
15 Top Web Design Tools & Resources To Try in 2024
15 Top Web Design Tools & Resources To Try in 2024
SitePoint Sponsors
7 Simple Rules for Better Data Visualization
7 Simple Rules for Better Data Visualization
Mariia Merkulova
Cloudways Autonomous: Fully-Managed Scalable WordPress Hosting
Cloudways Autonomous: Fully-Managed Scalable WordPress Hosting
SitePoint Team
Best Programming Language for AI
Best Programming Language for AI
Lucero del Alba
Quick Tip: How to Add Gradient Effects and Patterns to Text
Quick Tip: How to Add Gradient Effects and Patterns to Text
Ralph Mason
Logging Made Easy: A Beginner’s Guide to Winston in Node.js
Logging Made Easy: A Beginner’s Guide to Winston in Node.js
Vultr
How to Optimize Website Content for Featured Snippets
How to Optimize Website Content for Featured Snippets
Dipen Visavadiya
Psychology and UX: Decoding the Science Behind User Clicks
Psychology and UX: Decoding the Science Behind User Clicks
Tanya Kumari
Build a Full-stack App with Node.js and htmx
Build a Full-stack App with Node.js and htmx
James Hibbard
Digital Transformation with AI: The Benefits and Challenges
Digital Transformation with AI: The Benefits and Challenges
Priyanka Prajapat
Quick Tip: Creating a Date Picker in React
Quick Tip: Creating a Date Picker in React
Dianne Pena
How to Create Interactive Animations Using React Spring
How to Create Interactive Animations Using React Spring
Yemi Ojedapo
10 Reasons to Love Google Docs
10 Reasons to Love Google Docs
Joshua KrausZain Zaidi
How to Use Magento 2 for International Ecommerce Success
How to Use Magento 2 for International Ecommerce Success
Mitul Patel
5 Exciting New JavaScript Features in 2024
5 Exciting New JavaScript Features in 2024
Olivia GibsonDarren Jones
Tools and Strategies for Efficient Web Project Management
Tools and Strategies for Efficient Web Project Management
Juliet Ofoegbu
Choosing the Best WordPress CRM Plugin for Your Business
Choosing the Best WordPress CRM Plugin for Your Business
Neve Wilkinson
ChatGPT Plugins for Marketing Success
ChatGPT Plugins for Marketing Success
Neil Jordan
Managing Static Files in Django: A Comprehensive Guide
Managing Static Files in Django: A Comprehensive Guide
Kabaki Antony
The Ultimate Guide to Choosing the Best React Website Builder
The Ultimate Guide to Choosing the Best React Website Builder
Dianne Pena
Exploring the Creative Power of CSS Filters and Blending
Exploring the Creative Power of CSS Filters and Blending
Joan Ayebola
How to Use WebSockets in Node.js to Create Real-time Apps
How to Use WebSockets in Node.js to Create Real-time Apps
Craig Buckler
Best Node.js Framework Choices for Modern App Development
Best Node.js Framework Choices for Modern App Development
Dianne Pena
SaaS Boilerplates: What They Are, And 10 of the Best
SaaS Boilerplates: What They Are, And 10 of the Best
Zain Zaidi
Understanding Cookies and Sessions in React
Understanding Cookies and Sessions in React
Blessing Ene Anyebe
Enhanced Internationalization (i18n) in Next.js 14
Enhanced Internationalization (i18n) in Next.js 14
Emmanuel Onyeyaforo
Essential React Native Performance Tips and Tricks
Essential React Native Performance Tips and Tricks
Shaik Mukthahar
How to Use Server-sent Events in Node.js
How to Use Server-sent Events in Node.js
Craig Buckler
Five Simple Ways to Boost a WooCommerce Site’s Performance
Five Simple Ways to Boost a WooCommerce Site’s Performance
Palash Ghosh
Elevate Your Online Store with Top WooCommerce Plugins
Elevate Your Online Store with Top WooCommerce Plugins
Dianne Pena
Unleash Your Website’s Potential: Top 5 SEO Tools of 2024
Unleash Your Website’s Potential: Top 5 SEO Tools of 2024
Dianne Pena
How to Build a Chat Interface using Gradio & Vultr Cloud GPU
How to Build a Chat Interface using Gradio & Vultr Cloud GPU
Vultr
Enhance Your React Apps with ShadCn Utilities and Components
Enhance Your React Apps with ShadCn Utilities and Components
David Jaja
10 Best Create React App Alternatives for Different Use Cases
10 Best Create React App Alternatives for Different Use Cases
Zain Zaidi
Control Lazy Load, Infinite Scroll and Animations in React
Control Lazy Load, Infinite Scroll and Animations in React
Blessing Ene Anyebe
Building a Research Assistant Tool with AI and JavaScript
Building a Research Assistant Tool with AI and JavaScript
Mahmud Adeleye
Understanding React useEffect
Understanding React useEffect
Dianne Pena
Web Design Trends to Watch in 2024
Web Design Trends to Watch in 2024
Juliet Ofoegbu
Building a 3D Card Flip Animation with CSS Houdini
Building a 3D Card Flip Animation with CSS Houdini
Fred Zugs
How to Use ChatGPT in an Unavailable Country
How to Use ChatGPT in an Unavailable Country
Dianne Pena
An Introduction to Node.js Multithreading
An Introduction to Node.js Multithreading
Craig Buckler
How to Boost WordPress Security and Protect Your SEO Ranking
How to Boost WordPress Security and Protect Your SEO Ranking
Jaya Iyer
Understanding How ChatGPT Maintains Context
Understanding How ChatGPT Maintains Context
Dianne Pena
Building Interactive Data Visualizations with D3.js and React
Building Interactive Data Visualizations with D3.js and React
Oluwabusayo Jacobs
JavaScript vs Python: Which One Should You Learn First?
JavaScript vs Python: Which One Should You Learn First?
Olivia GibsonDarren Jones
13 Best Books, Courses and Communities for Learning React
13 Best Books, Courses and Communities for Learning React
Zain Zaidi
5 jQuery.each() Function Examples
5 jQuery.each() Function Examples
Florian RapplJames Hibbard
Implementing User Authentication in React Apps with Appwrite
Implementing User Authentication in React Apps with Appwrite
Yemi Ojedapo
AI-Powered Search Engine With Milvus Vector Database on Vultr
AI-Powered Search Engine With Milvus Vector Database on Vultr
Vultr
Understanding Signals in Django
Understanding Signals in Django
Kabaki Antony
Why React Icons May Be the Only Icon Library You Need
Why React Icons May Be the Only Icon Library You Need
Zain Zaidi
View Transitions in Astro
View Transitions in Astro
Tamas Piros
Getting Started with Content Collections in Astro
Getting Started with Content Collections in Astro
Tamas Piros
What Does the Java Virtual Machine Do All Day?
What Does the Java Virtual Machine Do All Day?
Peter Kessler
Become a Freelance Web Developer on Fiverr: Ultimate Guide
Become a Freelance Web Developer on Fiverr: Ultimate Guide
Mayank Singh
Layouts in Astro
Layouts in Astro
Tamas Piros
.NET 8: Blazor Render Modes Explained
.NET 8: Blazor Render Modes Explained
Peter De Tender
Mastering Node CSV
Mastering Node CSV
Dianne Pena
A Beginner’s Guide to SvelteKit
A Beginner’s Guide to SvelteKit
Erik KückelheimSimon Holthausen
Brighten Up Your Astro Site with KwesForms and Rive
Brighten Up Your Astro Site with KwesForms and Rive
Paul Scanlon
Which Programming Language Should I Learn First in 2024?
Which Programming Language Should I Learn First in 2024?
Joel Falconer
Managing PHP Versions with Laravel Herd
Managing PHP Versions with Laravel Herd
Dianne Pena
Accelerating the Cloud: The Final Steps
Accelerating the Cloud: The Final Steps
Dave Neary
An Alphebetized List of MIME Types
An Alphebetized List of MIME Types
Dianne Pena
The Best PHP Frameworks for 2024
The Best PHP Frameworks for 2024
Claudio Ribeiro
11 Best WordPress Themes for Developers & Designers in 2024
11 Best WordPress Themes for Developers & Designers in 2024
SitePoint Sponsors
Top 10 Best WordPress AI Plugins of 2024
Top 10 Best WordPress AI Plugins of 2024
Dianne Pena
20+ Tools for Node.js Development in 2024
20+ Tools for Node.js Development in 2024
Dianne Pena
The Best Figma Plugins to Enhance Your Design Workflow in 2024
The Best Figma Plugins to Enhance Your Design Workflow in 2024
Dianne Pena
Harnessing the Power of Zenserp for Advanced Search Engine Parsing
Harnessing the Power of Zenserp for Advanced Search Engine Parsing
Christopher Collins
Build Your Own AI Tools in Python Using the OpenAI API
Build Your Own AI Tools in Python Using the OpenAI API
Zain Zaidi
Get the freshest news and resources for developers, designers and digital creators in your inbox each week
Loading form