<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.1.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>Ernest Delgado</title>
	<link>http://ernestdelgado.com/archive</link>
	<description>It's time to show up.</description>
	<pubDate>Sat, 05 Dec 2009 06:02:13 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.1.3</generator>
	<language>en</language>
			<item>
		<title>Next &gt;</title>
		<link>http://ernestdelgado.com/archive/next/</link>
		<comments>http://ernestdelgado.com/archive/next/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 06:02:13 +0000</pubDate>
		<dc:creator>ernest</dc:creator>
		
		<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://ernestdelgado.com/archive/next/</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><img src="http://ernestdelgado.com/img/PostShots/gogoogle.png" title="I've gone Google" alt="I've gone Google" style="display: block" height="210" width="210" /></p>
]]></content:encoded>
			<wfw:commentRss>http://ernestdelgado.com/archive/next/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Rendering Animated GIFs on the Canvas Element</title>
		<link>http://ernestdelgado.com/archive/rendering-animated-gifs-on-the-canvas-element/</link>
		<comments>http://ernestdelgado.com/archive/rendering-animated-gifs-on-the-canvas-element/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 04:59:48 +0000</pubDate>
		<dc:creator>ernest</dc:creator>
		
		<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://ernestdelgado.com/archive/rendering-animated-gifs-on-the-canvas-element/</guid>
		<description><![CDATA[This 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 [...]]]></description>
			<content:encoded><![CDATA[<p>This 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.</p>
<p><a href="http://ernestdelgado.com/public-tests/gifoncanvas/" title="Gif On Canvas">The results</a> 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&#8217;t really know yet.</p>
<p><a href="http://ernestdelgado.com/public-tests/gifoncanvas/"><img class="snapshots" src="/img/PostShots/animgif-post.png"/></a></p>
]]></content:encoded>
			<wfw:commentRss>http://ernestdelgado.com/archive/rendering-animated-gifs-on-the-canvas-element/feed/</wfw:commentRss>
		</item>
		<item>
		<title>I&#8217;m back, so is Monkey Island!</title>
		<link>http://ernestdelgado.com/archive/im-back-so-is-monkey-island/</link>
		<comments>http://ernestdelgado.com/archive/im-back-so-is-monkey-island/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 09:44:16 +0000</pubDate>
		<dc:creator>ernest</dc:creator>
		
		<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://ernestdelgado.com/archive/im-back-so-is-monkey-island/</guid>
		<description><![CDATA[






Official Site
Ron Gilbert comments

]]></description>
			<content:encoded><![CDATA[<p><object width="370" height="270">
<param name="movie" value="http://www.youtube.com/v/5UDrXP3qM2Q&#038;hl=en&#038;fs=1&#038;"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<p><embed src="http://www.youtube.com/v/5UDrXP3qM2Q&#038;hl=en&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="370" height="270"></embed></object>
</p>
<ul>
<li><a href="http://www.lucasarts.com/games/monkeyisland/">Official Site</a></li>
<li><a href="http://grumpygamer.com/8280380">Ron Gilbert comments</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://ernestdelgado.com/archive/im-back-so-is-monkey-island/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Benchmark on the Floor</title>
		<link>http://ernestdelgado.com/archive/benchmark-on-the-floor/</link>
		<comments>http://ernestdelgado.com/archive/benchmark-on-the-floor/#comments</comments>
		<pubDate>Thu, 05 Feb 2009 07:19:36 +0000</pubDate>
		<dc:creator>ernest</dc:creator>
		
		<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://ernestdelgado.com/archive/benchmark-on-the-floor/</guid>
		<description><![CDATA[  

  In the projects I have been working lately I&#8217;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&#8217;t know of.


  There&#8217;s one test I want to mention here as [...]]]></description>
			<content:encoded><![CDATA[<p><img id="labels" src="/img/PostShots/graphlabels.png" style="position: absolute; top: -1000px;" />  </p>
<p>
  In the projects I have been working lately I&#8217;ve had to test the speed of a bunch of JavaScript functions. That was another good excuse for me to read more about different <a href="http://ejohn.org/blog/javascript-benchmark-quality/">ways of creating benchmarks</a> that I didn&#8217;t know of.
</p>
<p>
  There&#8217;s one test I want to mention here as it uses those obscure JavaScript syntax tricks that I like so much.
</p>
<p>
  The goal of this test was to find a faster way to run the<br />
<strong>Math.floor</strong> function to see if we could make some heavy loops of our scripts even faster. Here is where the <a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Operators/Bitwise_Operators">bitwise operators</a> come into the game. I saw the &#8220;~~&#8221; 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 <strong>average</strong> of all the <a href="http://developer.yahoo.com/yui/articles/gbs/">A-Grade browsers</a> tests gives us the following results:
</p>
<ul>
<li>Math.floor(n): 15.804</li>
<li>~~n: 8.784</li>
<li>n|n: 8.081</li>
<li>n&#038;n: 12.019</li>
</ul>
<h4>(Average time per instruction in microseconds)</h4>
<p>
  Apparently, the n|n option will be the best<br />
  candidate for our purpose. You can test it yourself in your browser:
</p>
<p><button id="startb">Test</button></p>
<p><canvas id="cvb" width="260" height="65"></canvas></p>
]]></content:encoded>
			<wfw:commentRss>http://ernestdelgado.com/archive/benchmark-on-the-floor/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Car Navigation Map in Canvas</title>
		<link>http://ernestdelgado.com/archive/car-navigation-map-in-canvas/</link>
		<comments>http://ernestdelgado.com/archive/car-navigation-map-in-canvas/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 05:32:40 +0000</pubDate>
		<dc:creator>ernest</dc:creator>
		
		<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://ernestdelgado.com/archive/car-navigation-map-in-canvas/</guid>
		<description><![CDATA[After browsing through the code of Jacob Seidelin&#8217;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 [...]]]></description>
			<content:encoded><![CDATA[<p>After browsing through the code of <a href="http://blog.nihilogic.dk/">Jacob Seidelin</a>&#8217;s Super Mario Kart <a href="http://blog.nihilogic.dk/2008/05/javascript-super-mario-kart.html">demo</a>, 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 <a href="http://ernestdelgado.com/public-tests/canvas-gpsmap/">proof of concept</a> that works pretty damn well in Firefox (and not quite that well in other browsers :).</p>
<p>After passing it around to a few friends, I&#8217;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!</p>
<p><a href="http://ernestdelgado.com/public-tests/canvas-gpsmap/"><img src="/img/PostShots/gps.png" class="snapshots" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://ernestdelgado.com/archive/car-navigation-map-in-canvas/feed/</wfw:commentRss>
		</item>
		<item>
		<title>JS Puzzle</title>
		<link>http://ernestdelgado.com/archive/js-puzzle/</link>
		<comments>http://ernestdelgado.com/archive/js-puzzle/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 15:48:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://ernestdelgado.com/archive/js-puzzle/</guid>
		<description><![CDATA[Write a function getMax(a,b) that takes two integers and returns the maximum value.
None of the following are allowed: &#62;, &#60;, ==, !=, Math.max, Math.min.

function getMax(a, b) {
 ...
 return max;
}


Send your answers here. I will post the solution in a few days.
Solution
]]></description>
			<content:encoded><![CDATA[<p>Write a function getMax(a,b) that takes two integers and returns the maximum value.<br />
None of the following are allowed: &gt;, &lt;, ==, !=, Math.max, Math.min.</p>
<pre class="snippet" style="width: 140px;"><code>
function getMax(a, b) {
 ...
 return max;
}

</code></pre>
<p style="clear: both;"><strike>Send your answers <a href="http://ernestdelgado.com/contact">here</a>. I will post the solution in a few days.</strike></p>
<p><strong><a href="http://ernestdelgado.com/public-tests/maxsolution/">Solution</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://ernestdelgado.com/archive/js-puzzle/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Chromeflow</title>
		<link>http://ernestdelgado.com/archive/chromeflow/</link>
		<comments>http://ernestdelgado.com/archive/chromeflow/#comments</comments>
		<pubDate>Thu, 11 Sep 2008 05:26:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://ernestdelgado.com/archive/chromeflow/</guid>
		<description><![CDATA[Based on the Rafi Adnan&#8217;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 [...]]]></description>
			<content:encoded><![CDATA[<p>Based on the <a href="http://radnan.public.iastate.edu/coverflow/">Rafi Adnan&#8217;s coverflow+canvas sample</a> posted in Ajaxian, I created a bookmarklet which will add more fun to the <strong>Most visited</strong> preview of your home page.
<p>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.</p>
<p><a href="javascript:(function() {  a=function() {/* Coverflow for Google Chrome home page by Ernest Delgado * http://ernestdelgado.com * Original Coverflow work written by - see below - *//* * THE BEER-WARE LICENSE * - rafiadnan47@gmail.com - wrote this file. As long as you retain this notice you * can do whatever you want with this stuff. If we meet some day, and you think * this stuff is worth it, you can buy me a beer in return - Rafi Adnan */ function CVFLnative(){for(var i = 0, l = arguments.length; i < l; i++) {arguments[i].implement = function(o){for(var p in o) {if(!this.prototype[p]) {this.prototype[p] = o[p];}}};}};if(!Array.implement || !Function.implement || !Number.implement || !String.implement) {CVFLnative(Array, Function, Number, String);}Array.implement({contains: function(i){return this.indexOf(i) != -1;},indexOf: function(item){for(var i = 0, l = this.length; i < l; i++) {if(this[i] == item) {return true;}}return false;}});Function.implement({bind: function(o, args){var fn1 = this;var fn2 = function(){return fn1.apply(o, arguments || args);};return fn2;},periodical: function(t, b){var f1 = this;var f2 = function(){return f1.apply(b || window);};return setInterval(f2, t);}});Number.implement({limit: function(a, b){return Math.min(b, Math.max(a, this));}});String.implement({camelCase: function(){return this.replace(/\-\w/g, function(m){return m.charAt(1).toUpperCase();});},contains: function(t, s){s = s || '';return (s + this + s).indexOf(s + t + s) != -1;},hyphenate: function(){return this.replace(/[A-Z]/g, function(m){return '-' + m.charAt(0).toLowerCase();});},toFloat: function(){return parseFloat(this);}});Number.prototype.toFloat = String.prototype.toFloat;window.webkit = navigator.appVersion.contains('WebKit');var CVFLClass = function(o){var k = function(){return this.init ? this.init.apply(this, arguments) : this;};k.prototype = o || {};CVFLextend(k, this);k.prototype.setOptions = function(o){var m = {};for(var p in this.options) {m[p] = this.options[p];}for(var p in o) {m[p] = o[p];}this.options = m;};return k;};var CVFLEl ={getStyle: function(p, ps){var v = this.style[p.camelCase()];if(document.defaultView &#038;&#038; (v == '' || ps)) {v = document.defaultView.getComputedStyle(this, ps || null).getPropertyValue(p.hyphenate());}else if(this.currentStyle &#038;&#038; v == '') {v = this.currentStyle[p.camelCase()];}if(v == 'auto' &#038;&#038; p == 'height') {return this.getHeight();}if(v == NaN) {return 0;}return v;},htmlElement: true,remove: function(){this.parentNode.removeChild(this);return this.parentNode;},setStyle: function(p, v){this.style[p] = v;return this;},setStyles: function(o){for(var p in o) {this.setStyle(p, o[p]);}return this;}};function CVFLextend(a, b){for(var p in b) {a[p] = b[p];}return a;};function CVFL(el){if(el.htmlElement) {return el;}if(typeof el == 'string') {el = document.getElementById(el);}return el ? CVFLextend(el, CVFLEl) : false;};/******************************************/var Anim = new CVFLClass({options:{duration: 600,overflow: true,onComplete: function(){},transition: function(i){return (i <= 0.5) ? Math.pow((2 * i), 4) / 2 : (2 - Math.pow((2 * (1 - i)), 4)) / 2;}},init: function(el, o){this.el = CVFL(el);this.setOptions(o);return this;},start: function(o){this.stop();this.now = {}; this.from = {}; this.to = {};for(var p in o){var from = o[p][0], to = o[p][1];if(!to &#038;&#038; to != 0) {to = from, from = parseFloat(this.el.getStyle(p));}this.from[p] = from; this.to[p] = to;}if(this.options.overflow){this.el.style.overflow = 'hidden';}this.startTime = new Date().getTime();this.timer = this.step.periodical(1000/60, this);return this;},calc: function(){for(var p in this.from){var d = this.options.transition(this.d);this.now[p] = (this.to[p] - this.from[p]) * d + this.from[p];}},set: function(){for(var p in this.now){var unit = (['opacity', 'zindex'].contains(p.toLowerCase())) ? '' : 'px';if(p.contains('color')){this.now[p] = parseInt(this.now[p]);}if(p == 'opacity' &#038;&#038; window.ie){this.el.style['filter'] = 'alpha(opacity='+ parseInt(this.now[p] * 100) +')';}this.el.style[p] = this.now[p] + unit;}},step: function(){var time = new Date().getTime();if(time < this.startTime + this.options.duration){this.d = (time - this.startTime) / this.options.duration;this.calc(); this.set();}else{this.stop();this.now = this.to;this.set();this.options.onComplete.call(this, this.el);}},stop: function(){clearInterval(this.timer);}});if(typeof TILT == 'undefined')TILT = true;var Coverflow ={load: 9000,scrollable: false,containerWidth: 0,list: [],options:{bgColor: '#fff',middleSpace: 10,createLabel: function(item){return item.label;},onSelectCenter: function(){}},selected: 0,check: function(){this.load--;if(this.load == 0){this.container.className = '';this.containerWidth = this.widthOffset*2 + this.options.middleSpace + 200;this.setup();this.wrapperAnim.options.onComplete = function(){};this.wrapperAnim.start({opacity: [1]});this.scrollable = true;}},init: function(list, o){this.scrollable = false;this.list = list || this.list;o = o || {};for(var p in o){this.options[p] = o[p];}this.container = CVFL('__cvfl-coverflow');this.container.className = 'loading';this.wrapper = CVFL('__cvfl-coverflow-wrapper');this.wrapperAnim = new Anim(this.wrapper);this.label = CVFL('__cvfl-coverflow-label');this.labelAnim = new Anim(this.label);this.label.style.opacity = 0;this.wrapper.style.opacity = 0;this.wrapper.innerHTML = '';this.load = this.list.length;for(var i = 0; i < this.list.length; i++){var img = new Image();img.onload = function(){Coverflow.check();Coverflow.widthOffset = img.width * Coverflow.wr;Coverflow.imageWidth = img.width;};img.src = this.list[i].src;}if(window.addEventListener){CVFL('__cvfl-coverflow').addEventListener('DOMMouseScroll', Coverflow.wheel.bind(Coverflow), false);window.addEventListener('keydown', CVFLLeftRight, false);}CVFL('__cvfl-coverflow').onmousewheel = Coverflow.wheel.bind(Coverflow);},hr: 0.62, wr: 0.64, mt: 25, mh: 50,widthOffset: 0,setup: function(list){var sel = this.selected;var start = (sel >= 3) ? sel - 3 : 0;var end = (sel >= 3) ? start + 7 : sel + 4;if(end > this.list.length){end = this.list.length;}for(var i = start; i < end; i++){var img = new Image(); img.src = this.list[i].src;img.id = '__cvfl-img-'+ i;img.onclick = function(){return Coverflow.select.apply(Coverflow, arguments);};this.wrapper.appendChild(img);var j = Math.abs(sel - i);var lOffset, zIndex;var hr = this.hr, wr = this.wr;if(i < sel){lOffset = (150 - (j * 50));zIndex = 500 - (j * 50);this.tilt(img, 'l', hr, wr, lOffset, zIndex);}else if(i == sel){lOffset = (this.widthOffset*2 - this.imageWidth + this.options.middleSpace) / 2 + 100;zIndex = 500;this.tilt(img, 'n', 1, 1, lOffset, zIndex);}else{lOffset = (this.containerWidth - 100 - this.widthOffset) + (50 * (j - 1));zIndex = 500 - (j * 50);this.tilt(img, 'r', hr, wr, lOffset, zIndex);}}CVFL('__cvfl-img-'+ this.selected).style.cursor = 'pointer';this.showLabel(this.selected);},working: false,chainDuration: 600,chains: [],select: function(n){if(this.working){return;}this.clearTimers();if(typeof n != 'number'){var id = n.target.id;var sel = parseInt(id.match(/__cvfl-img-(\d+)/)[1]);}else{var sel = n;}sel = sel.limit(0, this.list.length - 1);if(this.selected == sel){if(typeof n != 'number'){this.options.onSelectCenter.call(Coverflow, this.list[sel], '__cvfl-img-'+ sel);}return;}var old = parseInt(this.selected);if(Math.abs(old - sel) > 1){this.clearChains();this.startChain(sel, old);return;}this.selected = sel;CVFL(&#8217;__cvfl-img-&#8217;+ old).style.cursor = &#8221;;if(sel != old){this.labelAnim.start({opacity: [0]});}if(sel < old){this.working = true;var end = old + 4;if(end > this.list.length){end = this.list.length;}for(var i = old + 1; i < end; i++){this.shiftOut(i, 'r', old, sel, end);}var start = sel - 3;if(start < 0){start = 0;}var lOffset = (this.containerWidth - 100 - this.widthOffset - 50) + ((old - sel) * 50);var zIndex = 500 - ((old - sel) * 50);var dur = this.chainDuration / 2;this.tiltAway(old, 'r', lOffset, zIndex, dur);var fn = function(){Coverflow.center.apply(Coverflow, [sel, 'l', 1]);for(var i = start; i < sel; i++){Coverflow.shiftIn(i, 'l', old, sel);}};setTimeout(fn, dur / 2);}else if(old < sel){this.working = true;var end = old - 3;if(end < 0){end = 0;}for(var i = end; i < old; i++){this.shiftOut(i, 'l', old, sel, end);}var start = sel + 4;if(start > this.list.length){start = this.list.length;}var lOffset = 150 - ((sel - old) * 50);var zIndex = 500 - ((sel - old) * 50);var dur = this.chainDuration / 2;this.tiltAway(old, &#8216;l&#8217;, lOffset, zIndex, dur);var fn = function(){Coverflow.center.apply(Coverflow, [sel, &#8216;r&#8217;, 1]);for(var i = sel + 1; i < start; i++){Coverflow.shiftIn(i, 'r', old, sel);}};setTimeout(fn, dur / 2);}},clearChains: function(){clearInterval(this.chainTimer);this.chains = [];},startChain: function(sel, old){var d = Math.abs(old - sel);var n = old;if(old < sel){for(var i = old + 1; i <= sel; i++){this.chains.push(i);}}else{for(var i = old - 1; i >= sel; i&#8211;){this.chains.push(i);}}var fn = function(){return Coverflow.nextFrame.apply(Coverflow);};this.chainDuration = 600 / d;this.chainTimer = setInterval(fn, 1000/40);},nextFrame: function(){var dur = this.chainDuration;if(this.chains.length > 0){if(!this.working){var sel = this.chains.shift();this.select(sel, dur);}}else{this.clearChains();this.chainDuration = 600;}},showLabel: function(sel){this.label.innerHTML = this.options.createLabel.call(this, this.list[this.selected]);this.labelAnim.start({opacity: [1]});},timers: [],clearTimers: function(){for(var i = 0; i < this.timers.length; i++){(this.timers[i].stop) ? this.timers[i].stop() : clearInterval(this.timers[i]);}this.timers = [];},center: function(n, dir, len, l, move){var finalLeft = (this.widthOffset*2 - this.imageWidth + this.options.middleSpace) / 2 + 100, finalZ = 500;var id = '__cvfl-img-'+ n, el = CVFL(id);el.style.zIndex = finalZ;var hr = [this.hr, 1], wr = [this.wr, 1], mt = [this.mt, 0], mh = [this.mh, 0];var left = parseInt(el.getStyle('left'));var z = parseInt(el.getStyle('zIndex'));var startTime, duration = this.chainDuration / len, timer;if(move){duration /= 2;}var complete = false;var setupCanvas = function(hr_now, wr_now, lOffset, zIndex, mt_now, mh_now, tiltOverride){var el = CVFL(id);var img = new Image();img.src = el.src;img.id = el.id;img.onclick = el.onclick;el.parentNode.replaceChild(img, el);var tilt = tiltOverride || dir;Coverflow.tilt(img, tilt, hr_now, wr_now, lOffset, finalZ, mt_now, mh_now);};var step = function(){var time = new Date().getTime();if(time < startTime + duration){var x = transition((time - startTime) / duration);var hr_now = (hr[1] - hr[0]) * x + hr[0];var wr_now = (wr[1] - wr[0]) * x + wr[0];var mt_now = (mt[1] - mt[0]) * x + mt[0];var mh_now = (mh[1] - mh[0]) * x + mh[0];var lOffset = (finalLeft - left) * x + left;var zIndex = (finalZ - z) * x + z;setupCanvas(hr_now, wr_now, lOffset, zIndex, mt_now, mh_now);}else{clearInterval(timer);setupCanvas(hr[1], wr[1], finalLeft, finalZ, mt[1], mh[1], 'n');Coverflow.showLabel(n);Coverflow.working = false;CVFL('__cvfl-img-'+ Coverflow.selected).style.cursor = 'pointer';}};startTime = new Date().getTime();timer = setInterval(step, 1000 / 40);this.timers.push(timer);},tiltAway: function(n, dir, finalLeft, finalZ, duration){var id = '__cvfl-img-'+ n, el = CVFL(id);finalZ += 100;el.style.zIndex = finalZ;var hr = [1, this.hr], wr = [1, this.wr], mt = [0, this.mt], mh = [0, this.mh];var left = parseInt(el.getStyle('left'));var z = parseInt(el.getStyle('zIndex'));var startTime, duration = duration || this.chainDuration, timer;var setupCanvas = function(hr_now, wr_now, lOffset, zIndex, mt_now, mh_now){var el = CVFL(id);var img = new Image();img.src = el.src;img.id = el.id;img.onclick = el.onclick;el.parentNode.replaceChild(img, el);Coverflow.tilt(img, dir, hr_now, wr_now, lOffset, finalZ, mt_now, mh_now);};var step = function(){var time = new Date().getTime();if(time < startTime + duration){var x = transition((time - startTime) / duration);var hr_now = (hr[1] - hr[0]) * x + hr[0];var wr_now = (wr[1] - wr[0]) * x + wr[0];var mt_now = (mt[1] - mt[0]) * x + mt[0];var mh_now = (mh[1] - mh[0]) * x + mh[0];var lOffset = Math.ceil((finalLeft - left) * x + left);var zIndex = Math.ceil((finalZ - z) * x + z);setupCanvas(hr_now, wr_now, lOffset, zIndex, mt_now, mh_now);}else{finalZ -= 100;clearInterval(timer);setupCanvas(hr[1], wr[1], finalLeft, finalZ, mt[1], mh[1]);}};startTime = new Date().getTime();timer = setInterval(step, 1000 / 40);this.timers.push(timer);},shiftOut: function(i, dir, old, sel, edge){var d = Math.abs(old - sel);var el = CVFL('__cvfl-img-'+ i);var l = parseInt(el.getStyle('left'));l = (dir == 'r') ? (l + 50 * d) : (l - 50 * d);var z = parseInt(el.getStyle('zIndex')) - (50 * d);el.setStyle('zIndex', z);var o = {left: [l]};var fn = function(){};if(i < sel - 3 || i > sel + 3){o.opacity = [1, 0];fn = function(el){el.remove();};}this.timers.push(new Anim(el, {onComplete: fn, duration: this.chainDuration}).start(o));},shiftIn: function(i, dir, old, sel){if(i < old - 3 || i > old + 3){var img = new Image(); img.src = this.list[i].src;img.id = &#8216;__cvfl-img-&#8217;+ i;img.onclick = function(){return Coverflow.select.apply(Coverflow, arguments);};(dir == &#8216;l&#8217;) ? this.wrapper.insertBefore(img, this.wrapper.firstChild) : this.wrapper.appendChild(img);var j = (dir == &#8216;l&#8217;) ? old - 3 - i : i - old - 3;var left = (dir == &#8216;l&#8217;) ? (0 - 50 * j) : ((this.containerWidth - this.widthOffset) + 50 * j);Coverflow.tilt(img, dir, this.hr, this.wr, left, (350 - 50 * j));CVFL(&#8217;__cvfl-img-&#8217;+ i).style.opacity = 0;}var d = Math.abs(old - sel);var el = CVFL(&#8217;__cvfl-img-&#8217;+ i);var l = parseInt(el.getStyle(&#8217;left&#8217;));l = (dir == &#8216;l&#8217;) ? (l + 50 * d) : (l - 50  * d);var z = parseInt(el.getStyle(&#8217;zIndex&#8217;)) + (50 * d);el.setStyle(&#8217;zIndex&#8217;, z);this.timers.push(new Anim(el, {duration: this.chainDuration}).start({left: [l], opacity: [1]}));},tilt: function(image, tilt, hratio, wratio, lOffset, zIndex, tOffset, hOffset){var prnt = image.parentNode;var canvas = document.createElement(&#8217;canvas&#8217;), res;if(canvas.getContext){var ih = image.height, iw = image.width;var ref_h = Math.floor(ih / 2);if(tilt != &#8216;n&#8217;){canvas.style.top = Math.ceil(tOffset || this.mt) +&#8217;px&#8217;;hOffset = hOffset || this.mh;hOffset = Math.ceil(hOffset);ref_h -= hOffset/2;ih -= hOffset/2;if(!TILT){iw = this.imageWidth*wratio;}}var h = ih + ref_h, w = iw;canvas.id = image.id;canvas.style.width = w +&#8217;px&#8217;; canvas.width = w;canvas.style.height = h +&#8217;px&#8217;; canvas.height = h;canvas.style.left = lOffset +&#8217;px&#8217;;canvas.style.zIndex = zIndex;canvas.onclick = image.onclick;canvas.src = image.src;var ctx = canvas.getContext(&#8217;2d&#8217;);prnt.replaceChild(canvas, image);ctx.clearRect(0, 0, canvas.width, canvas.height);ctx.globalCompositeOperation = &#8217;source-over&#8217;;ctx.fillStyle = &#8216;rgba(0, 0, 0, 0)&#8217;;ctx.fillRect(0, 0, canvas.width, canvas.height);ctx.save();try{ctx.translate(0, canvas.height);ctx.scale(1, -1);ctx.drawImage(image, 0, -(canvas.height - ref_h - ref_h), canvas.width, canvas.height - ref_h);ctx.restore();}catch(e){ this.clearTimers(); this.init(); this.working = false; return; }ctx.globalAlpha = 0.8;ctx.fillStyle = &#8216;#fff&#8217;;ctx.fillRect(0, h - ref_h, w, ref_h);if(this.options.bgColor != &#8221;){ctx.globalCompositeOperation = &#8216;destination-over&#8217;;ctx.fillStyle = this.options.bgColor;ctx.fillRect(0, canvas.height - ref_h, canvas.width, ref_h);}ctx.globalCompositeOperation = &#8217;source-over&#8217;;ctx.drawImage(image, 0, 0, iw, ih);ctx.save();ctx.strokeStyle = &#8216;#000&#8242;;ctx.strokeRect(0,0, iw, ih);if(TILT &#038;&#038; tilt != &#8216;n&#8217;){res = document.createElement(&#8217;canvas&#8217;);if(res.getContext){var o ={position: &#8216;fixed&#8217;, left: &#8216;-9999px&#8217;, top: &#8216;0px&#8217;,height: canvas.height +&#8217;px&#8217;, width: canvas.width +&#8217;px&#8217;};for(var p in o){res.style[p] = o[p];}res.height = canvas.height; res.width = canvas.width;}if(res.getContext){ctx = res.getContext(&#8217;2d&#8217;);ctx.globalCompositeOperation = &#8217;source-over&#8217;;ctx.clearRect(0, 0, res.width, res.height);var width = 5, l = Math.ceil(w/width);for(var i = 0; i < l; i++){try {var crap = (res.height - (res.height * hratio)) / 2;var dest_x = i * width, dest_y = 0;var src_y = crap * (i / l);var src_x = dest_x;if(tilt == 'r'){src_y = Math.ceil(crap * ((l - i - 1) / l));}var dest_h = res.height - src_y * 2;ctx.drawImage(canvas, dest_x, dest_y, width, res.height, src_x, src_y, width, dest_h);}catch(e) {ctx.drawImage(canvas, dest_x, dest_y, 1, res.height, src_x, src_y, width, dest_h);}}ctx.save();if(canvas.getContext){var tw = parseInt(canvas.width * wratio);canvas.width = tw; canvas.style.width = tw +'px';ctx = canvas.getContext('2d');ctx.clearRect(0, 0, canvas.width, canvas.height);ctx.globalCompositeOperation = 'source-over';this.removeExcess(tilt, ctx, 0, 0, canvas.width, canvas.height, hratio, ref_h);ctx.clip();ctx.drawImage(res, 0, 0, canvas.width, canvas.height);ctx.save();}}}ctx.save();}return canvas;},removeExcess: function(dir, ctx, x, y, w, h, hr){var crap = (h - (h * hr)) / 2;ctx.beginPath();if(dir == 'l'){ctx.moveTo(x, y); ctx.lineTo(w, y + crap); ctx.lineTo(w, y + h - crap); ctx.lineTo(x, y + h);}else{ctx.moveTo(x, y + crap); ctx.lineTo(x + w, y); ctx.lineTo(x + w, y + h); ctx.lineTo(x, y + h - crap);}ctx.closePath();},wheel: function(e){if(this.load != 0 || !this.scrollable){return;}if(e.preventDefault){e.preventDefault();}e.returnValue = false;if(e.wheelDelta){delta = e.wheelDelta / 120;}else if(e.detail){delta = -e.detail / 3;}if(delta){var sel = this.selected;if(delta < 0){sel++;}else{sel--;}sel = sel.limit(0, this.list.length - 1);this.select(sel);}}};function transition(i){return (i <= 0.5) ? Math.pow((2 * i), 4) / 2 : (2 - Math.pow((2 * (1 - i)), 4)) / 2;};function CVFLLeftRight(e){var sel = Coverflow.selected;if(e.keyCode == 39){sel++;}else if(e.keyCode == 37){sel--;}sel = sel.limit(0, Coverflow.list.length - 1);Coverflow.select(sel);};function reinit(){Coverflow.wrapperAnim.options.onComplete = function(){ Coverflow.init(); };Coverflow.wrapperAnim.start({opacity: [0]});};var TILT = true;CVFLEl.getCoords = function(){var el = this;var pos = {x: 0, y: 0, w: this.offsetWidth, h: this.offsetHeight};while(el &#038;&#038; el != document.body){pos.x += el.offsetLeft, pos.y += el.offsetTop;el = el.offsetParent;}return pos;};if (window.location != 'chrome-resource://new-tab/') { alert('Chromeflow only works on the Chrome history view (default new tab).');return; }if (window.setOnce) { return; }var pEl = document.createElement('div'); pEl.id = '__cvfl-coverflow';var c1El = document.createElement('div'); c1El.id = '__cvfl-coverflow-wrapper';var c2El = document.createElement('div'); c2El.id = '__cvfl-coverflow-label';pEl.appendChild(c1El);pEl.appendChild(c2El);document.body.appendChild(pEl);var sEl = document.createElement('style');var sTxt = document.createTextNode('canvas { position:absolute; cursor: pointer; }');sEl.appendChild(sTxt);sEl.id = 'dyn-style';var head = document.getElementsByTagName('head')[0];head.appendChild(sEl);document.body.style.position = 'relative';pEl.style.height = '311px';pEl.style.margin = 'auto';pEl.style.overflow = 'hidden';pEl.style.position = 'relative';pEl.style.width = '461px';c2El.style.color = '#000';c2El.style.font = '14pt Lucida Grande, Lucida Sans Unicode';c2El.style.lineHeight = '1.3em';c2El.style.position = 'relative';c2El.style.textAlign = 'center';c2El.style.top = '153px';c2El.style.zIndex = '700';var cvReady = function() {if (document.getElementById('__cvfl-coverflow') === null) {setTimeout(function() { check(); }, 2);} else {var imgSrcs = [];var imgs = document.getElementsByTagName('img');for (var i = 0, len = imgs.length; i < len; ++i) {if (/thumb/.test(imgs[i].src)) {imgSrcs.push({src:imgs[i].src, label: imgs[i].parentNode.title, url: imgs[i].src.match(/thumb\/(.*)$/)[1]});}}var cTable = document.getElementById('mostvisitedtable');cTable.style.margin = '0 auto';cTable.style.padding = '40px 0 0 0';cTable.style.width = '626px';cTable.innerHTML = '';cTable.appendChild(pEl);Coverflow.init(imgSrcs, {createLabel: function(item){return item.label;},onSelectCenter: function(item, id){window.location = item.url;}});}};cvReady();window.setOnce = true;};if (/Firefox/.test(navigator.userAgent)) { setTimeout(a,0)} else {a()}})()">Chromeflow</a></p>
<p>(Press CTRL+B to make the bookmarks toolbar show up)</p>
<p><img src="http://ernestdelgado.com/img/PostShots/gflow.png" class="snapshots"/></p>
]]></content:encoded>
			<wfw:commentRss>http://ernestdelgado.com/archive/chromeflow/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Drag and Drop without Drag and Drop</title>
		<link>http://ernestdelgado.com/archive/drag-and-drop-without-drag-and-drop/</link>
		<comments>http://ernestdelgado.com/archive/drag-and-drop-without-drag-and-drop/#comments</comments>
		<pubDate>Mon, 01 Sep 2008 02:03:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://ernestdelgado.com/archive/drag-and-drop-without-drag-and-drop/</guid>
		<description><![CDATA[While 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.
Demo

Update: Testing the [...]]]></description>
			<content:encoded><![CDATA[<p>While experimenting the other day, I found out about a special behavior of input fields in web browsers. Mixing it up with images and the <a href="http://www.ernestdelgado.com/public-tests/canvasphoto/">previous canvas experiment</a>, I came up with a <a href="http://ernestdelgado.com/articles/ddwdd/">proof of concept</a> that emulates image drag and drop behavior.</p>
<p>As a bonus, it also allows drag and drop between documents.</p>
<p><a href="http://ernestdelgado.com/articles/ddwdd/">Demo</a></p>
<p><a href="http://ernestdelgado.com/articles/ddwdd/"><img class="snapshots" src="http://ernestdelgado.com/img/PostShots/ddwdd.png" /></a></p>
<p><strong>Update:</strong> Testing the demo in <strong>Google Chrome</strong> 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.</p>
]]></content:encoded>
			<wfw:commentRss>http://ernestdelgado.com/archive/drag-and-drop-without-drag-and-drop/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Moving Forward</title>
		<link>http://ernestdelgado.com/archive/moving-forward/</link>
		<comments>http://ernestdelgado.com/archive/moving-forward/#comments</comments>
		<pubDate>Sun, 24 Aug 2008 04:17:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://ernestdelgado.com/archive/moving-forward/</guid>
		<description><![CDATA[I think it&#8217;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
&#8220;Move the web platform forward&#8221;:

]]></description>
			<content:encoded><![CDATA[<p>I think it&#8217;s worth taking a look where canvas is positioned in the following graph shown by Vic Gundotra at the<br />
last Google IO (2008) when talking about the evolution of the web browser and how to<br />
<span class="q" cite="http://www.youtube.com/watch?v=vk1HvP7NO5w">&#8220;Move the web platform forward&#8221;</span>:</p>
<p><a target="_blank" href="http://ernestdelgado.com/img/PostShots/graphio.png"><img src="http://ernestdelgado.com/img/PostShots/graphio_small.png" class="snapshots" title="Open Web Technologies" alt="Open Web Technologies" height="232" width="350" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://ernestdelgado.com/archive/moving-forward/feed/</wfw:commentRss>
		</item>
		<item>
		<title>SXSW 2009</title>
		<link>http://ernestdelgado.com/archive/sxsw-2009/</link>
		<comments>http://ernestdelgado.com/archive/sxsw-2009/#comments</comments>
		<pubDate>Sat, 16 Aug 2008 08:37:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://ernestdelgado.com/archive/sxsw-2009/</guid>
		<description><![CDATA[The 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 [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://developer.mozilla.org/en/docs/Canvas_tutorial" title="Mozilla Canvas Tutorial" target="_blank">canvas element</a> has been generating increasingly more interest and<br />
broad web acceptance in the past year - noticeably more than similar<br />
technologies like SVG or VML that have been around for<br />
much longer.</p>
<p><a href="http://learningtheworld.eu/2008/upcoming-talks-aria-canvas/" title="Martin Kliehm" target="_blank">Martin Kliehm</a> has kindly offered me the opportunity to participate in<br />
a dual presentation at the next <a href="http://sxsw.com/" title="sxsw 2009" target="_blank">SXSW</a> to talk about canvas and<br />
demonstrate some interesting uses.</p>
<p>If you are interested in the canvas element, you can <a href="http://panelpicker.sxsw.com/ideas/view/1328" title="Vote for Canvas Panel" target="_blank">cast your vote</a> for<br />
this presentation (until August 29). And while you&#8217;re at it, you might also want to <a href="http://groups.google.com/group/google-excanvas/browse_thread/thread/6f35f6db27462b10/d4b77fa839073e01" title="Vote for Canvas Support in IE8" target="_blank">cast your vote<br />
for canvas support in IE8</a>.</p>
<p><a href="http://panelpicker.sxsw.com/ideas/view/1328"><img src="http://ernestdelgado.com/img/PostShots/sxsw09.png" class="snapshots" title="SXSW 09" alt="SXSW 09" height="111" width="350" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://ernestdelgado.com/archive/sxsw-2009/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
