Notes
Take them as Lorem Ipsum
Rendering Animated GIFs on the Canvas Element
Aug 19, 2009This is probably as old as the very first implementations of the Canvas Element. But the truth is that I never thought about what could happen if you render an animated GIF in a Canvas through the drawImage method.
The results were somehow the ones I was expecting but the question is: could these be useful at any specific situation? My honest answer is, I don't really know yet.
Benchmark on the Floor
Feb 04, 2009
In the projects I have been working lately I've had to test the speed of a bunch of JavaScript functions. That was another good excuse for me to read more about different ways of creating benchmarks that I didn't know of.
There's one test I want to mention here as it uses those obscure JavaScript syntax tricks that I like so much.
The goal of this test was to find a faster way to run the Math.floor function to see if we could make some heavy loops of our scripts even faster. Here is where the bitwise operators come into the game. I saw the "~~" trick in a forum thread and I found another two playing for a while with the JavaScript console (all of them round a number the same way). The average of all the A-Grade browsers tests gives us the following results:
- Math.floor(n): 15.804
- ~~n: 8.784
- n|n: 8.081
- n&n: 12.019
(Average time per instruction in microseconds)
Apparently, the n|n option will be the best candidate for our purpose. You can test it yourself in your browser:
Car Navigation Map in Canvas
Nov 24, 2008After browsing through the code of Jacob Seidelin's Super Mario Kart demo, I was inspired to take the code and attempt to create a GPS-navigation system experience using publicly available roadmap tiles. The final result is a proof of concept that works pretty damn well in Firefox (and not quite that well in other browsers :).
After passing it around to a few friends, I've already heard some cool suggestions for taking the demo to the next level. So, please, if this inspires you, feel free to experiment further with the code. Enjoy!
JS Puzzle
Oct 09, 2008Write a function getMax(a,b) that takes two integers and returns the maximum value. None of the following are allowed: >, <, ==, !=, Math.max, Math.min.
function getMax(a, b) {
...
return max;
}
Send your answers here. I will post the solution in a few days.
Chromeflow
Sep 10, 2008Based on the Rafi Adnan's coverflow+canvas sample posted in Ajaxian, I created a bookmarklet which will add more fun to the Most visited preview of your home page.
Simply drag the link below to your bookmarks bar in Chrome, open up a new tab (with the default home page), and click the bookmarklet to see your history displayed iTunes-style.
(Press CTRL+B to make the bookmarks toolbar show up)
Drag and Drop without Drag and Drop
Aug 31, 2008While experimenting the other day, I found out about a special behavior of input fields in web browsers. Mixing it up with images and the previous canvas experiment, I came up with a proof of concept that emulates image drag and drop behavior.
As a bonus, it also allows drag and drop between documents.
Update: Testing the demo in Google Chrome shows a funny highlighting effect when dragging images. Also, they can be dropped only in a small area on the top left of the text area.
Moving Forward
Aug 23, 2008I think it's worth taking a look where canvas is positioned in the following graph shown by Vic Gundotra at the last Google IO (2008) when talking about the evolution of the web browser and how to "Move the web platform forward":
SXSW 2009
Aug 16, 2008The canvas element has been generating increasingly more interest and broad web acceptance in the past year - noticeably more than similar technologies like SVG or VML that have been around for much longer.
Martin Kliehm has kindly offered me the opportunity to participate in a dual presentation at the next SXSW to talk about canvas and demonstrate some interesting uses.
If you are interested in the canvas element, you can cast your vote for this presentation (until August 29). And while you're at it, you might also want to cast your vote for canvas support in IE8.
Rendering Polygons with Canvas
Jun 22, 2008This time I wanted to test the performance of the canvas rendering versus other technologies. Since Google Maps uses VML, SVG and image retrieval depending on which browser you are using, I compared the rendering times of the maps polygons to see the results.
In the end it wasn't the best environment to do the tests since it was impossible for me to split the actual rendering time of the polygons and the rest of the processes of the map code. In any case, I leave the experiment for you to see.
Canvas
May 31, 2008I am releasing an experiment I made last October when I started playing with the canvas element.
One of the main reasons I started to play with this technology was that while I was trying to port a previous SVG experiment, I noticed it had quite a few cross browser issues. The final result with canvas was quite satisfactory and it gave me the chance to learn features beyond the basics such as drag and drop, event handlers and performance optimization.
Since that experiment in October my interests and prototypes in Canvas have been more and more challenging: Skewing techniques, VR emulation, polygon rendering, etc. There's a bunch of code to release though I am not allowed to release all of it right now. But I will do my best.
Update: Due to the interest and enhancement requests from friends and colleagues, I have created a project page where you can contribute and add items to the to do list.
Update 2: Check the Flickr and Picasa integration from Michael Johnston and Pamela Fox respectively.
View all notes...
Articles
It doesn't hurt
Image Transformations in Canvas with Slicing (by Ross Harmes and Ernest Delgado)
Jun 23, 2008Published on the Yahoo! User Interface Blog
User registration patterns (URP)
Nov 24, 2007In this article we will try to prove that some practices in current web apps have important privacy and security issues both for the user and for the application.
About
I am a workaholic Software Engineer working in the Silicon Valley and living in San Francisco doing what I like to do best by creating new ways to access, visualize and organize information.
More...


I am a workaholic Software Engineer 


