<?xml version="1.0" encoding="UTF-8"?>
<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/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Journal - Mark Brown</title>
	<atom:link href="http://www.yellowshoe.com.au/journal/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.yellowshoe.com.au/journal</link>
	<description>HTML, CSS, Javascript</description>
	<lastBuildDate>Fri, 27 Apr 2012 11:20:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Back to work</title>
		<link>http://www.yellowshoe.com.au/journal/back-to-work/</link>
		<comments>http://www.yellowshoe.com.au/journal/back-to-work/#comments</comments>
		<pubDate>Mon, 23 Apr 2012 10:42:35 +0000</pubDate>
		<dc:creator>Mark Brown</dc:creator>
				<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://www.yellowshoe.com.au/journal/?p=210</guid>
		<description><![CDATA[I signed my life away to <a href="https://twitter.com/inspire9">@inspire9</a> today, I'm very happy to be working in such an amazing community and look forward to my work there.]]></description>
			<content:encoded><![CDATA[<div class="frame"><img src="/journal/wp-content/uploads/2012/04/i9.jpg"></div>
<h2>Leaving full-time employment</h2>
<p>Leaving my job was the best thing I have done for my career and personal development.<br />
Being unemployed without a plan is a very freeing and revealing thing, you are forced to ask those important questions like &#8220;What do I want to be doing with my short time left on the planet?&#8221; and &#8220;What do I want my work to accomplish?&#8221;.</p>
<p>I haven&#8217;t yet answered either of those, but having some free time on my hands I was able for the first time in a long while choose what I wanted to work on.  I set very simple, achievable goals for myself &#8211; I would linger around Inspire9, take on some freelance jobs to support myself and study.  For a year I would see if I could sustain myself and work on my craft, I also wanted to work along side talented people I could learn from.</p>
<h2>Client work</h2>
<p>I love working directly with clients, being able to contribute to a design, offer advice across wide areas(staffing, ux, design, development, workflows, timelines, marketing etc.).  I like the fact that small clients are small, they have more riding on their projects being successful and I like being able to contribute to that success.</p>
<p>I will continue to take on client work wherever I can.</p>
<h2>Extremely fortunate</h2>
<p>I feel extremely fortunate to be working on the web, in Melbourne.  There is a huge amount of good work available, I thought this would be the case but I was still surprised at the amount.  If you feel that you could be doing something more satisfying with your time, leave.</p>
<p>I only worked with four clients in my short time as a freelancer, two of those clients offered me ongoing work for the rest of the year that I&#8217;ve gladly accepted.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yellowshoe.com.au/journal/back-to-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Faith and Reason</title>
		<link>http://www.yellowshoe.com.au/journal/faith-and-reaso/</link>
		<comments>http://www.yellowshoe.com.au/journal/faith-and-reaso/#comments</comments>
		<pubDate>Sat, 14 Apr 2012 04:52:17 +0000</pubDate>
		<dc:creator>Mark Brown</dc:creator>
				<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://www.yellowshoe.com.au/journal/?p=171</guid>
		<description><![CDATA[It seems it's become unfashionable to have faith in a god these days, it's often the subject of ridicule in all types of media - books, video, radio &#038; especially online, where opinions are cheap and plentiful(it also helps being anonymous).  The atheist convention is on in Melbourne and here's a few thoughts.]]></description>
			<content:encoded><![CDATA[<h2>Didn&#8217;t science kill religion?</h2>
<p>You may have engaged in the God vs Science debates yourself as I have.  Personally, I didn&#8217;t find them to be at odds with one another primarily because Science observes nature and God doesn&#8217;t inhabit that natural world.  How God <em>does</em> inhabit the world is open to debate and criticism. It is true that scientific discoveries are explaining things that previously were used as arguments for God, this is the &#8220;God of the gaps&#8221; argument for atheism.</p>
<p>I welcome this argument and it&#8217;s a great reminder that a mystery in itself isn&#8217;t evidence for anything.  As new evidences arise my understanding grows and I get a more complete picture of how things came to be.  The scientific &amp; historical claims of Christianity should be questioned, things like creation and how God intervenes in the world.</p>
<p>I welcome hearing about both religion and science.  I generally find listening to people is a good way to learn and grow, I also find the opposite to be true.</p>
<p><q><span>There is a principle which is a bar against all information, which cannot fail to keep a man in everlasting ignorance — that principle is contempt prior to investigation.</span></q></p>
<h2>Character &#038; personal accounts</h2>
<p>I&#8217;ve been fortunate to grow up with some intelligent Christian friends who have demonstrated what life as a Christian with some integrity looks like.  I realize that those I grew up with is a small sample size and doesn&#8217;t represent the entire church.</p>
<p>I&#8217;m interested in reading Religion for Atheists by Alain de Botton, at a glance the book seems to highlight certain virtues that I have grown to appreciate and respect about my Christian friends &#8211; Community, respect, humility &amp; honesty.  This book is a healthy break from the Dawkins crowd of celebrity atheists.  The character traits most easily identifiable in the influential atheists is arrogance and ego. No doubt these are smart people, but they&#8217;re still jerks who encourage people to think themselves better than believers.</p>
<p>Don&#8217;t get me wrong, I am not calling Christians virtuous and atheists arrogant jerks.<br />
I am recalling from personal accounts the effect that Christianity has had on the characters of many of my friends.  I think many aspects of Christianity have encouraged these character traits in my friends and these are not evidences for God.<br />
Church has encouraged people to come together regularly, church encourages study &#038; reflection on morality and ethics regularly, the study of Jesus&#8217; character, a deep respect for all people as we&#8217;re all brothers/sisters, personal reflection and solitude through prayer and quietness, an emphasis that true value is in not in material possessions &#8211; I could go on.</p>
<p>I am also referring to the character traits that some atheist friends have adopted when listening to the Dawkins breed of popular atheist, a general militant opposition.  This is understandable &#8211; regardless of the topic, it makes people feel good to believe they know more than others.  I don&#8217;t want to be militarily opposed to anyone, especially my friends.  Let&#8217;s talk, reason, grow and learn together but let us all respect how little we actually know.</p>
<p>Character and integrity are extremely important topics, from my perspective the message and practices of Christianity are making a more positive contribution to the world than the messages and practices of those waving the atheism banner.</p>
<h2>Biblical critique</h2>
<p>I normally find myself disagreeing with the arguments for atheism when they attack biblical passages because they cherry pick and make big issues out of the things that are actually small issues from the standpoint of the entire bible.<br />
Some of the most obvious issues are creation, homosexuality &#038; hell &#8211; These topics are written about in the bible but they are only covered in a handful of verses.  These handful of verses are not things that make huge impact on character.</p>
<p>I read the bible from start to finish and have studied the new testament &#038; Jesus&#8217; teaching a little more.  I you haven&#8217;t read the bible before you would probably be quite surprised with what&#8217;s inside &#8211; it&#8217;s not a rule book or condemning.  It is a collection of 66 books written by many different authors, 39 before of the time of Jesus in the &#8220;old testament&#8221; which make up the Hebrew bible of Judaism. The different books were written over a long period of time from 2150 B.C. to about 100 A.D<br />
My favorite books are the Wisdom books, Ecclesiastes and Proverbs in particular.<br />
A lot of the bible is historical accounts, songs, prayers, prophecy or letters(that were only intended to be read and shared by those receiving them)</p>
<p>I&#8217;m no expert but I would summarize the bible as a collection of writings about God written by many authors over a time span of over 2000 years. It&#8217;s the story of the Jewish people trying to understand Him, the life of Jesus and the early church.</p>
<h2>The arguments</h2>
<p>I will say that I do find the arguments on the atheist side of most debates more compelling.<br />
This is to be expected though as God can&#8217;t be proven or disproven by argument, he is said to reveal himself through personal/spiritual means and only to those who earnestly seek him.</p>
<p>Without the experience of growing up with Christians I would most probably be waving the banner alongside the others at the Global Atheist Convention.  As it turns out I might just listen in and take The Good Parts.</p>
<p>I&#8217;ve found myself quite bored with the debate over the last year though and haven&#8217;t engaged as much.  People just seemed to love rehashing old arguments and there&#8217;s not actually all that much new interesting content.  I value original thought.</p>
<h2>My persuasion</h2>
<p>Let&#8217;s all be reasonable, yet humble.<br />
Don&#8217;t adopt others views quickly and rehash arguments, think and test stuff.<br />
Don&#8217;t slander the bible or Christianity if you don&#8217;t understand it, ask questions.<br />
Acknowledge the good that the message of Christ is doing in the world.</p>
<p>I&#8217;m in Desmond&#8217;s corner.</p>
<p><q><span>My humanity is bound up in yours, for we can only be human together.</span></q></p>
<div class="frame"><img src="http://www.yellowshoe.com.au/journal/wp-content/uploads/2012/03/tutu.jpg"></div>
]]></content:encoded>
			<wfw:commentRss>http://www.yellowshoe.com.au/journal/faith-and-reaso/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Touch swipe events</title>
		<link>http://www.yellowshoe.com.au/journal/touch-swipe-events/</link>
		<comments>http://www.yellowshoe.com.au/journal/touch-swipe-events/#comments</comments>
		<pubDate>Fri, 30 Mar 2012 07:54:36 +0000</pubDate>
		<dc:creator>Mark Brown</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.yellowshoe.com.au/journal/?p=182</guid>
		<description><![CDATA[I had to make an iOS like UI today and transition in different 'pages' by swiping.  A few gotcha's and how-to's if you're building something similar.]]></description>
			<content:encoded><![CDATA[<h2>HTML &#8211; Laying out the grid</h2>
<p>I first laid out a grid with a visible region the size of one of the pages.</p>
<div class="frame"><img src="/journal/wp-content/uploads/2012/03/grid.jpg"></div>
<pre><code lang="html">&lt;div id="grid-wrap"&gt;
  &lt;div id="grid"&gt;
    &lt;div id="pos-0-0"&gt;&lt;/div&gt;
    &lt;div id="pos-1-0"&gt;&lt;/div&gt;
    &lt;div id="pos-2-0"&gt;&lt;/div&gt;
    &lt;div id="pos-0-1"&gt;&lt;/div&gt;
    &lt;div id="pos-1-1"&gt;&lt;/div&gt;
    &lt;div id="pos-2-1"&gt;&lt;/div&gt;
    &lt;div id="pos-0-2"&gt;&lt;/div&gt;
    &lt;div id="pos-1-2"&gt;&lt;/div&gt;
    &lt;div id="pos-2-2"&gt;&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;</code></pre>
<h2>CSS</h2>
<p>All examples use SASS and Compass.</p>
<pre><code lang="css">$height: 748px;
$width: 1024px;
$rows = 3;
$cols = 3;

#grid-wrap {
  height: $height;
  width: $width;
  overflow: hidden;
}
#grid {
  height: $height * $rows;
  width: $width * $cols;
  @include transition(all .3s ease-in-out);
}
#grid > div {
  position: absolute;
  height: $height;
  width: $width;
  -webkit-backface-visibility: hidden;
}
@for $y from 0 through $rows-1 {
  @for $x from 0 through $cols-1 {
    .no-csstransforms {
      .pos-$x-$y {
        top: $y;
        left: $x;
      }
    }
    .csstransforms {
      .pos-$x-$y #grid {
        @include transform(translate($x*-$width, $y*-$height));
      }
    }
  }
}</code></pre>
<p>I first just transitioned the top and left values and it worked everywhere but the performance on the iPad wasn&#8217;t the best.  Webkit has heavily optimised transforms using translate so the result was much better using translate.  You could use modernizr to get the best of both worlds and serve transforms to the browsers that understand it. #winning.</p>
<p>-webkit-backface-visibility: hidden; is necessary so that the device renders the content off screen so that it doesn&#8217;t repaint when it&#8217;s scrolled in from one of the edges &#8211; without it the images flicker after a transition.</p>
<p>-webkit-backface-visibility did add a problem for me though, I was using a &lt;video&gt; element with video.js and I couldn&#8217;t click the play button within one of the elements with that property set. It took me a while to figure out but if you add a transform to the elements you need to interact with it somehow pulls them back into line.</p>
<pre><code lang="css">.video {
  @include transform(translate(0, 0));
}</code></pre>
<h2>Javascript</h2>
<p>I modified the <a href="http://www.netcu.de/jquery-touchwipe-iphone-ipad-library">jQuery Touchwipe Plugin</a> so that it normalised click and drag as well as touch events.  I also added a afterSwipe callback to make it a little more useful for me.</p>
<pre><code lang="javascript">$body = $('body');
var updatePos = function() {
  $body[0].className = 'pos-' + pos.x + '-' + pos.y;
}
$swiper = $body.swipe({
  swipeLeft: function() {
    if (pos.x < 2 &#038;&#038; pos.y !== 0)
    pos.x = pos.x+1;
  },
  swipeRight: function() {
    if (pos.x > 0 &#038;&#038; pos.y !== 0)
    pos.x = pos.x-1;
  },
  swipeUp: function() {
    if (pos.y < 2)
    pos.y = pos.y+1;
  },
  swipeDown: function() {
    if (pos.y > 0)
    pos.y = pos.y-1;
  },
  afterSwipe: updatePos,
  threshold: 20,
  preventDefaultEvents: true
});</code></pre>
<p>It&#8217;s fun playing with some of the -webkit features and seeing how they&#8217;ve optimised different features they deemed worthy enough for it.  The ease-in-out transitions with transforms feel just like the native experience &#8211; It&#8217;s worth going the extra steps to optimise for these devices.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yellowshoe.com.au/journal/touch-swipe-events/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SVG Motion Paths</title>
		<link>http://www.yellowshoe.com.au/journal/svg-motion-paths/</link>
		<comments>http://www.yellowshoe.com.au/journal/svg-motion-paths/#comments</comments>
		<pubDate>Thu, 15 Mar 2012 00:48:51 +0000</pubDate>
		<dc:creator>Mark Brown</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[SVG]]></category>

		<guid isPermaLink="false">http://www.yellowshoe.com.au/journal/?p=87</guid>
		<description><![CDATA[Building a simple HTML5 game this week I've learned heaps about motion graphics, Canvas and SVG.  I've also learnt a few new tricks with Sass and CSS transitions for keeping my code clean.]]></description>
			<content:encoded><![CDATA[<h2>Game On</h2>
<div class="frame" style="margin-bottom: 1em">
  <img src="/journal/wp-content/uploads/2012/03/board.jpg" alt="The game board" style="display: block">
</div>
<p>The <a href="http://www.twusuper.com.au/supergameoflife/">Super Game of Life</a> was beautifully designed by <a href="http://ie.com.au/">a Melbourne design agency</a>, it&#8217;s a simple turn based game with multiple choice answers.</p>
<p>You spin to move your car around the track, answering questions along the way, if you answer correctly you add sweet moolah to your Super, as you pass Go you collect 2 years.  The game ends when you answer all 12 questions correctly or are 10 years wiser.</p>
<h3>Animation basics</h3>
<p>All animation libraries at their core are a loop that runs as many times as they can over a given time, throughout the loop they calculate the change in position by multiplying the total distance by a progress(between 0 and 1) by an easing function. Easing functions make an animation slow down or speed up throughout the animation.</p>
<p>Here&#8217;s a simple example showing how a position between 0 and 100 could be calculated.</p>
<pre><code lang="javascript">var easing = {
  linear: function (n) {
    return n;
  },
  easeIn: function (n) {
    return Math.pow(n, 1.7);
  },
  easeOut: function (n) {
    return Math.pow(n, .48);
  }
}
var progress = [0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1];
var distance = 100;

for (var i=0, ii = progress.length; i&lt;ii; i++) {
  var position = distance * easing.linear(progress[i])
  console.log(position);
}</code></pre>
<div class="table-wrap">
<table>
<tr>
<th>linear</th>
<td>0</td>
<td>10</td>
<td>20</td>
<td>30</td>
<td>40</td>
<td>50</td>
<td>60</td>
<td>70</td>
<td>80</td>
<td>90</td>
<td>100</td>
</tr>
<tr>
<th>easeIn</th>
<td>0</td>
<td>2</td>
<td>6</td>
<td>13</td>
<td>21</td>
<td>31</td>
<td>42</td>
<td>55</td>
<td>68</td>
<td>84</td>
<td>100</td>
</tr>
<tr>
<th>easeOut</th>
<td>0</td>
<td>33</td>
<td>46</td>
<td>56</td>
<td>64</td>
<td>72</td>
<td>78</td>
<td>84</td>
<td>90</td>
<td>95</td>
<td>100</td>
</tr>
</table>
</div>
<p>Read through the source of <a href="http://berniesumption.com/software/animator/">Animator.js</a> if you want to learn more about it.</p>
<h2>The Car</h2>
<div class="frame" style="margin-bottom: 1em">
  <img src="/journal/wp-content/uploads/2012/03/car.jpg" style="display: block">
</div>
<p>I&#8217;m a big fan of <a href="http://raphaeljs.com/">Raphael.js</a> so at first I tried to use SVG exclusively for the car, animation and path tracking &#8211; and it was working, but testing on the first generation iPad the performance was just too slow to have the desired effect for the game.  I ended up using SVG for the path &#038; Canvas for the rendering.</p>
<h3>Motion paths</h3>
<p><a href="https://developer.mozilla.org/en/DOM/SVGPathElement">SVG paths</a> have the DOM methods getTotalLength() and getPointAtLength(length) which can be used to get specific points along a path.<br />
Those are all we need to move an element along an SVG path with some simple animation timers &#8211; I used jQuery&#8217;s animate function to do this so I didn&#8217;t have to re-invent them. You could pull parts of Animator.js out if you wanted to this yourself.</p>
<h3>Rotation</h3>
<p><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Math/atan2">Math.atan2</a>(point2.x-point1.x, point2.y-point1.y) returns the angle between two points in radians.</p>
<p>When drawing an image on a rotated canvas you need to draw relative to the pivot point of the image &#8211; In the case of the car that&#8217;s the point at the base between the wheels.<br />
ctx.drawImage(image, 0-(width/2), 0-height, width, height);</p>
<h3>Canvas&#8217; transformation matrix</h3>
<p>It took me a little while to understan Canvas&#8217; translation matrix, the <a href="https://developer.mozilla.org/en/Drawing_Graphics_with_Canvas#section_6">Mozilla Canvas docs</a> helped.</p>
<p>If you&#8217;re going to be using rotation in your canvas animations you&#8217;ll need to use save() and restore() to save the current transformation matrix so that you can get back to different points in building the frames.  I think of it as building a frame on the way up using translate, rotate &amp; draw, then tearing it back down again on the way back.</p>
<ul>
<li>clear &#8211; entire canvas
<li>save &#8211; untransformed matrix at (0,0)
<li>translate &#8211; point(x,y)
<li>rotate &#8211; radians
<li>draw &#8211; relative to pivot point
<li>restore &#8211; restore untransformed matrix
</ul>
<h3>The code</h3>
<pre><code lang="javascript">var game = {
  postion: 1,
  steps: 5,
  halfPi: Math.PI/2,
  initPaper: function() {
    var p = game.paper = Raphael('paper', 1022, 762);
    game.path = p.path('M196.5,117.5L906,118c0,0,27.038,5.5,27,29c-0.039,24.331,0,96,0,96s2,28-23,32s-283,2-283,2s-75.86,11.37-76,91c-0.142,81.018,71,88,71,88h52c0,0,31,6,31,40s1,92,1,92s-8,68-74,67s-264,0.011-264,0.011s-24-2.934-24-29.011c0-22.5,22.913-25.153,22.913-25.153L408,601c0,0,75-17,79-94s-82.742-93.03-82.742-93.03L173,414c0,0-76-6-78-78s0-113,0-113l7-28c0,0,0-39,26-62s60-21,60-21L196.5,117.5z').attr({ 'stroke-width': 0 });
    game.pathPoints = [.96, .01, .1, .176, .247, .31, .42, .5, .570, .645, .71, .81, .882, .999];
    game.pathLength = game.path.getTotalLength();
    game.canvas = document.getElementById('canvas');
    game.ctx = dgame.canvas.getContext("2d");

    var img = new Image();
    img.src = 'img/car-work-horse-small.png';
    game.carImage = img;
    game.animateCar(.95, 1, 1000);
  }
  stepCar: function() {
    if (game.steps == 0) return;
    game.steps--;
    var start = game.position;
    game.position++;
    game.animateCar(game.pathPoints[start], game.pathPoints[game.position], 1000, game.stepCar);
  },
  paintCar: function(point) {
    game.x = point.x;
    game.y = point.y;

    var ctx = game.ctx;
    ctx.clearRect(0, 0, game.canvas.width, game.canvas.height);
    ctx.save();
    ctx.translate(game.x, game.y);
    ctx.rotate(game.rotation);
    ctx.drawImage(game.carImage, 0-(game.carWidth/2), 0-game.carHeight, game.carWidth, game.carHeight);
    ctx.restore();
  },
  animateCar: function(start, end, time, complete) {
    var distance = (end-start)*game.pathLength;
    start = start * game.pathLength;
    var ctx = game.ctx;
    var dy, dx, rotation;
    $canvas.animate({ "progress": 1 }, {
      easing: "linear",
      duration: time,
      step: function(a, obj) {
        var point = game.path.getPointAtLength(start + (obj.state * distance));
        dx = point.x-game.x;
        dy = point.y-game.y;
        var rotation = 0-(Math.atan2(dx,dy) - game.halfPi);
        if (dx == 0 &#038;&#038; dy == 0) return; /* same point */
        game.rotation = rotation;
        game.paintCar(point);
      },
      complete: complete || function() {}
    });
  }
}</code></pre>
<h2>The Spinner</h2>
<p>I started out making the spinner rotate with CSS transitions when a click &#038; drag was detected. That was pretty simple to achieve with CSS transitions for a smooth animation with easing.  Sass also helped keep the code nice and simple with math, variables &#038; loops.</p>
<pre><code lang="css">#wheel {
  background: url(../img/spinner.png);
  height: 230px;
  width: 230px;
  position: absolute;
  @include transition(all 1.5s ease-out);
  @for $i from 1 through 6 {
    $rotation = 360deg*3 + $i*60;
    &#038;.spin-#{$i} {
      @include transform(rotate($rotation));
    }
    &#038;.reverse.spin-#{$i} {
      @include transform(rotate(0-$rotation));
    }
  }
}</code></pre>
<pre><code lang="javascript">var touching = false;
var down = function(event) {
  touching = true;
  return false;
}
var move = function(event) {
  if (touching &#038;&#038; !game.spinning) {
    spin();
    touching = false;
  }
}
var up = function(event) {
  touching = false;
}
if (window.Touch) {
  $spinner.bind('touchstart',down);
  $spinner.bind('touchmove',move);
  $spinner.bind('touchend',up);
}
else {
  $spinner.mousedown(down);
  $spinner.mousemove(move);
  $spinner.mouseup(up);
}

function spin() {
  game.spinning = true;
  var number = Math.floor(Math.random()*6)+1;
  $wheel.addClass('spin-'+number);
  game.steps = 6-number || 6;

  setTimeout(function() {
    $wheel.removeClass();
    game.spinning = false;
  }, 3000);
}</code></pre>
<h2>Going both ways</h2>
<div class="frame media">
  <img src="/journal/wp-content/uploads/2012/03/quadrants.jpg">
</div>
<p>Making the spinner go in the reverse was a little more challenging. I needed to capture two points and then figure out which direction it was moving relative to the center of the spinner.</p>
<p>I ended up finding a pretty easy solution by dividing the spinner into into 4 quadrants and simply checking it was moving in one direction. Not perfect, but it works for real world cases.</p>
<p>e.g. If you touched in q1 it&#8217;s spinning in reverse if you move down.</p>
<pre><code lang="javascript">var offset = $wheel.offset();
var pos = null,
quadrant = null,
center = { x: offset.left+115, y: offset.top+115 };

function getPos(event) {
  return {
    x: event.pageX,
    y: event.pageY
  }
}
function getQuadrant() {
  if (pos.x <= center.x &#038;&#038; pos.y <= center.y)
    return 1;
  if (pos.x >= center.x &#038;&#038; pos.y <= center.y)
    return 2;
  if (pos.x >= center.x &#038;&#038; pos.y >= center.y)
    return 3;
  if (pos.x <= center.x &#038;&#038; pos.y >= center.y)
    return 4;
  return null;
}
var down = function(event) {
  event = (window.Touch) ? event.originalEvent.touches[0] : event.originalEvent;
  pos = getPos(event);
  q = getQuadrant();
}
var move = function(event) {
  event = (window.Touch) ? event.originalEvent.touches[0] : event.originalEvent;
  var pos2 = getPos(event);
  if ((q == 1 &#038;&#038; pos2.y > pos.y)
   || (q == 2 &#038;&#038; pos2.x < pos.x)
   || (q == 3 &#038;&#038; pos2.y < pos.y)
   || (q == 4 &#038;&#038; pos2.x > pos.x)) {
    game.spinReverse = true;
  }
  else {
    game.spinReverse = false;
  }
}
var up = function(event) {
  pos = null;
}</code></pre>
<h2>Modals and ornaments</h2>
<div class="frame" style="margin-bottom:1em">
<img src="/journal/wp-content/uploads/2012/03/borders.jpg" style="display: block">
</div>
<p>The dialogs are positioned off screen and transitioned in just by adding a class &#8216;active&#8217;. There&#8217;s really no need for complex javascript frameworks to achieve these sorts of effects anymore &#8211; with CSS3&#8242;s transitions it makes it easy.</p>
<p>I&#8217;ve started using generated content for ornamental elements that aren&#8217;t absolutely necessary for an element to function like the ribbons top &amp; bottom of the dialogs.</p>
<pre><code lang="html">&lt;div id="overlay" class="active"&gt;&lt;/div&gt;
&lt;div id="choose" class="card active"&gt;
&lt;/div&gt;</code></pre>
<pre><code lang="css">#overlay {
  background: rgba(0,0,0,.4);
  position: fixed;
  height: 100%;
  width: 100%;
  opacity: 0;
  @include transition(opacity .3s linear);
  &#038;.active {
    opacity: 1;
  }
}
.card {
  position: absolute;
  top: -800px;
  opacity: 0;
  background: #fff url(../img/texture.jpg);
  @include transition(all .5s ease-in);
  &#038;.active {
    top: 115px;
    opacity: 1;
  }
  &#038;:before {
    content: '';
    height: 11px;
    position: absolute;
    top: -11px;
    left: 0;
    right: 0;
    background: url(../img/ribbon-top.png);
  }
  &#038;:after {
    content: '';
    height: 11px;
    position: absolute;
    bottom: -11px;
    left: 0;
    right: 0;
    background: url(../img/ribbon-bottom.png);
  }
}</code></pre>
<p>These newer CSS properties make the code a lot leaner and easier to change, the way it should be.</p>
<p>And that&#8217;s it! I hope some of the code is useful in your own projects.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yellowshoe.com.au/journal/svg-motion-paths/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Burger</title>
		<link>http://www.yellowshoe.com.au/journal/burger/</link>
		<comments>http://www.yellowshoe.com.au/journal/burger/#comments</comments>
		<pubDate>Sat, 10 Mar 2012 09:17:18 +0000</pubDate>
		<dc:creator>Mark Brown</dc:creator>
				<category><![CDATA[Food]]></category>

		<guid isPermaLink="false">http://www.yellowshoe.com.au/journal/?p=97</guid>
		<description><![CDATA[In the last three weeks I've been to Misty's, NSHRI, Huxtaburger, Andrews &#038; Grill'd, I love a good burger, but I make an even meaner one.]]></description>
			<content:encoded><![CDATA[<h2>A Hot Burger</h2>
<div class="frame"><img src="/journal/wp-content/uploads/2012/03/burger.jpg" alt="" /></div>
<h2>Ingredients</h2>
<div style="float:left; width: 280px">
<h3>Patties</h3>
<ul>
<li>Beef Mince
<li>Onion
<li>Garlic
<li>Rosemary &amp; Thyme
<li>Breadcrumbs
<li>Worcestershire
<li>Tabasco
<li>Salt &amp; Pepper
</ul>
</div>
<div style="float:left; width: 280px">
<h3>Toppings</h3>
<ul>
<li>Toasted buns
<li>Lettuce
<li>Tomato
<li>Tasty cheese
<li>Bacon
<li>Baxters Tomato Relish
<li>Mayonnaise
<li>Beaver Brand Jalapeno mustard
</ul>
</div>
<p style="clear:left">The Jalapeno mustard / mayo / tomato relish makes this one Tasty Burger.<br />
And, it works out to about $2.50 per burger.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yellowshoe.com.au/journal/burger/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Node, a simple server</title>
		<link>http://www.yellowshoe.com.au/journal/node-as-a-simple-server/</link>
		<comments>http://www.yellowshoe.com.au/journal/node-as-a-simple-server/#comments</comments>
		<pubDate>Fri, 02 Mar 2012 06:01:54 +0000</pubDate>
		<dc:creator>Mark Brown</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.yellowshoe.com.au/journal/?p=71</guid>
		<description><![CDATA[Firing up a simple web server is super handy, I've started using node so that I can fire up a server from any directory and view the pages from multiple devices and VM's.]]></description>
			<content:encoded><![CDATA[<p>Most of the things I am working on at the moment are simple front-end prototypes.<br />
Browsing local files via file:///Users/markbrown4/projects/ in different browsers is problematic, you can&#8217;t make ajax requests, some browsers treat local files differently.</p>
<h2>Enter Node</h2>
<p>Node takes a .js file and fires up a web server.<br />
It has a heap of uses, in this case we only need it to do a little &#8211; serve html, css &#038; js.</p>
<h2>Install</h2>
<pre><code style="color: #fff">cd ~/projects/
git clone https://github.com/joyent/node.git
cd node
git checkout v0.6.7
./configure
make
sudo make install</code></pre>
<p>Write a simple web server that serves html, css &#038; js called.. &#8220;front-end-ftw.js&#8221; and put it in the directory of your site / app.</p>
<pre><code lang="javascript">var http = require('http');
var fs = require('fs');
var path = require('path');

http.createServer(function (request, response) {

  console.log('request starting...');

  var filePath = '.' + request.url;
  if (filePath == './')
      filePath = './index.htm';

  var extname = path.extname(filePath);
  var contentType = 'text/html';
  switch (extname) {
    case '.js':
    contentType = 'text/javascript';
    break;
    case '.css':
    contentType = 'text/css';
    break;
  }

  path.exists(filePath, function(exists) {
    if (exists) {
      fs.readFile(filePath, function(error, content) {
        if (error) {
          response.writeHead(500);
          response.end();
        }
        else {
          response.writeHead(200, { 'Content-Type': contentType });
          response.end(content, 'utf-8');
        }
      });
    }
    else {
      response.writeHead(404);
      response.end();
    }
  });
}).listen(8125);

console.log('Server running at http://127.0.0.1:8125/');</code></pre>
<p>http://thecodinghumanist.com/blog/archives/2011/5/6/serving-static-files-from-node-js</p>
<h2>Run it</h2>
<pre><code style="color: #fff">cd ~/projects/my-kick-ass-project/
node front-end-ftw</code></pre>
<h2>Anywhere</h2>
<p>Load http://127.0.0.1:8125/ on an iDevice or test it in your windows vm.</p>
<h2>Content types</h2>
<p>From there you can add any extra content types you want to serve differently, if you want to be able to load images directly in the browser you can add the extensions.<br />
Making an offline web app? Add a cache manifest MIME type.</p>
<pre><code lang="javascript">case '.jpg':
  contentType = 'image';
  break;
case '.png':
  contentType = 'image';
  break;
case '.json':
  contentType = "application/json";
  break;
case '.manifest':
  contentType = 'text/cache-manifest';
  break;</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.yellowshoe.com.au/journal/node-as-a-simple-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vendor prefixes</title>
		<link>http://www.yellowshoe.com.au/journal/vendor-prefixes/</link>
		<comments>http://www.yellowshoe.com.au/journal/vendor-prefixes/#comments</comments>
		<pubDate>Sat, 11 Feb 2012 23:46:48 +0000</pubDate>
		<dc:creator>Mark Brown</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.yellowshoe.com.au/journal/?p=64</guid>
		<description><![CDATA[There are two things that should happen.
Developers should stop coding vendor prefixes by hand &#38; vendors shouldn't add any more prefixes into production releases.]]></description>
			<content:encoded><![CDATA[<p>I agree with Remy Sharp that other vendors including -webkit vendor prefix support is <a href="http://remysharp.com/2012/02/09/vendor-prefixes-about-to-go-south/" title="Vendor Prefixes - about to go south">bat shit crazy</a>.</p>
<p><strong>Developers should stop coding vendor prefixes by hand</strong></p>
<p>During development you can use <a href="http://leaverou.github.com/prefixfree/">prefix-free</a> and for production pre-compile your css.  <a href="http://compass-style.org/reference/compass/css3/">Compass&#8217; CSS3 module</a> makes short work of this.  Just include the feature and use it.</p>
<pre><code style="color:#fff">@import "compass/css3";
div { @include border-radius(10px) }</code></pre>
<p>This centralisation of vendor-prefixing is what is needed.  As support is added in browsers Compass can be updated to include new prefixes all without you having to change source code plugging in all the holes.</p>
<p><strong>Vendors shouldn&#8217;t add any more prefixes into production releases</strong>.<br />
&#8220;Non-production ready browsers should support experimental prefixes, production ready releases should not.&#8221; &#8211; <a href="http://twitter/rem/">@rem</a></p>
<p>The prefixes should be kept to nightly / beta builds for testing purposes only.  That was the intention for them anyway, those really interested in testing the features and giving feedback will and we won&#8217;t have this problem going forward.<br />
This means the CSS working group will need to standardize these properties fast so they can hit the stable releases.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yellowshoe.com.au/journal/vendor-prefixes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compass is Bad Ass</title>
		<link>http://www.yellowshoe.com.au/journal/compass-is-bad-ass/</link>
		<comments>http://www.yellowshoe.com.au/journal/compass-is-bad-ass/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 05:25:51 +0000</pubDate>
		<dc:creator>Mark Brown</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.yellowshoe.com.au/journal/?p=45</guid>
		<description><![CDATA[I will certainly be using Compass in the future for building sites, whether they are static or dynamic.  Pre-compilers and static site generators are all the rage right now, Haml, Sass &#038; CoffeeScript have changed things for the better, there's no reason to be scared of them.]]></description>
			<content:encoded><![CDATA[<div class="media"><img src="http://www.yellowshoe.com.au/journal/wp-content/uploads/2012/01/files.png"></div>
<h2>Install</h2>
<ul>
<li>Install the compass gem</li>
<li>Create a site</li>
<li>Watch for changes</li>
</ul>
<p>This will sit in the background and compile your CSS whenever you make changes to any of the files. <strong>Awesome</strong>.</p>
<pre style="clear: both"><code style="color: #fff">gem update --system
gem install compass
compass create test-app
mate test-app
compass watch test-app</code></pre>
<div class="frame"><img src="http://www.yellowshoe.com.au/journal/wp-content/uploads/2012/01/watch.png"></div>
<h2>sprites</h2>
<pre><code style="color: #fff">@import "icon/*.png";
@include all-icon-sprites;</code></pre>
<p>And, you&#8217;re done.</p>
<p>That&#8217;s right. Those two lines will generate the sprite image and styles automagically for you.<br />
I also like to include a sprite class which makes an element behave line a normal image.</p>
<pre><code lang="css">.sprite {
  display: inline-block;
  vertical-align: middle;
  height: 16px;
  width: 16px;
  overflow: hidden;
  text-indent: -9999px;
}</code></pre>
<pre><code lang="html">&lt;b class="sprite icon-tick"&gt;Save&lt;/b&gt;</code></pre>
<p>There&#8217;s another include for spriting regular, hover &#038; active states as well.</p>
<pre><code style="color: #fff">@import "selectors/*.png";
@include all-selectors-sprites;</code></pre>
<ul>
<li>selectors/comment.png
<li>selectors/comment_hover.png
<li>selectors/comment_active.png
</ul>
<h2>Compass features</h2>
<p>I&#8217;ve only played with the css3 &#038; reset utilities so far, a reset stylesheet is included by default. There are <a href="http://compass-style.org/reference/compass/utilities/">many more utilities</a> though which I&#8217;ll be playing with.</p>
<p>One of the best features in my opinion of the whole compass piece is the color utilities like lighten(color, amount) &#038; darken(color, amount). <br />When you&#8217;re tweaking a design you&#8217;re often just tweaking contrasts, this is where these two utilities shine.</p>
<div class="frame"><img src="http://www.yellowshoe.com.au/journal/wp-content/uploads/2012/01/output.png"></div>
<pre><code style="color: #fff">@import "compass/reset";
@import "compass/css3";
$link-color: #0084B4;</code></pre>
<pre><code lang="css">a {
  color: $link-color;
}
a:hover {
  color: darken($link-color, 15%);
}</code></pre>
<p>Using variables for things makes a lot of sense.</p>
<p>You could define gutter widths for a design and then set widths &#038; margins in your layout using simple maths meaning you can change the spacing globally.</p>
<h2>css3 mixins</h2>
<p>There&#8217;s a background function which will generate vendor prefixes and supports multiple background images.  You can even mix colors into rbga() if you don&#8217;t know the specific RGB values, a color is a color.</p>
<pre><code style="color: #fff">#header {
  @include background(
    linear-gradient(top, rgba(black,0) 50%, rgba(black,.3)),
    image-url("textures/tartan.png")
  );
}
#wrapper {
  @include border-radius(10px);
}</code></pre>
<h2>Deploy!</h2>
<p>When you&#8217;re ready to deploy combine and minify your assets</p>
<pre><code style="color: #fff">compass compile -e production --force</code></pre>
<p>Easy as pie.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yellowshoe.com.au/journal/compass-is-bad-ass/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First week</title>
		<link>http://www.yellowshoe.com.au/journal/first-week/</link>
		<comments>http://www.yellowshoe.com.au/journal/first-week/#comments</comments>
		<pubDate>Fri, 06 Jan 2012 03:25:04 +0000</pubDate>
		<dc:creator>Mark Brown</dc:creator>
				<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://www.yellowshoe.com.au/journal/?p=34</guid>
		<description><![CDATA[My first week on the outside was thoroughly enjoyable and satisfying.  Working for yourself somehow seems more honest, you know precisely what you have done and accomplished and are completely accountable for what you produce.]]></description>
			<content:encoded><![CDATA[<h2>Inspire9</h2>
<div class="media frame">
<img src="http://www.yellowshoe.com.au/journal/wp-content/uploads/2012/01/lift.jpg">
</div>
<p>The LOLivator works pretty hard and requires a rest often. If you push this hard worker over the edge on a Friday the lights will go out.  The door isn&#8217;t too heavy though so can claw your way out.</p>
<p>It&#8217;s got a bit of charm, don&#8217;t you think?</p>
<div class="media frame">
<img src="http://www.yellowshoe.com.au/journal/wp-content/uploads/2012/01/office.jpg">
</div>
<p>I&#8217;m still finding my way around the new office but it&#8217;s filled with friendly, intelligent people making interesting things for the web.  It looks and feels like a great place to build things with a good mix of skills and expertise.</p>
<p>I did manage to find one PC in the office. I can only assume it&#8217;s there for testing things in Internet Explorer, what else would it be used for?</p>
<h2>Sights &amp; sounds</h2>
<div class="media frame">
<img src="http://www.yellowshoe.com.au/journal/wp-content/uploads/2012/01/ass.jpg">
</div>
<ul>
<li>The local coffee is quite good.
<li>It&#8217;s just 10 minutes from home, I might even borrow one of my house mates <em>twelve</em> bikes and ride in.
<li>Good taste in music, though I can&#8217;t help visualizing <a href="http://www.youtube.com/watch?v=a_426RiwST8">The Lonely Boy</a> whenever I hear the iconic Black Keys song.
<li>A <a href="http://www.makerbot.com/">MakerBot</a> was delivered to the office.
</ul>
<h2>Business</h2>
<p>I&#8217;m not flippant with work if I&#8217;ve made a commitment to it, but business is all secondary to that other stuff for me at the moment.<br />
Right now, I&#8217;m optimizing my life for happiness, health <span class="amp">&amp;</span> study.</p>
<p>I did manage to pick up two small jobs this week after recommendations from earlier work &#8211; <em>which I am very thankful for</em>.</p>
<h2>Coda</h2>
<p>I&#8217;ve got a few leads to follow up on, and it looks like some work done this week will lead to some more.  I realise it&#8217;s <em>very</em> early days still, but, going out and walking my own path hasn&#8217;t been all that scary and I have zero regrets so far.</p>
<p><em>Carpe Diem</em> baby.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yellowshoe.com.au/journal/first-week/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dabblet previewers</title>
		<link>http://www.yellowshoe.com.au/journal/dabblet-previewers/</link>
		<comments>http://www.yellowshoe.com.au/journal/dabblet-previewers/#comments</comments>
		<pubDate>Mon, 02 Jan 2012 02:36:11 +0000</pubDate>
		<dc:creator>Mark Brown</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[SVG]]></category>

		<guid isPermaLink="false">http://www.yellowshoe.com.au/journal/?p=7</guid>
		<description><![CDATA[I was really impressed when I saw <a href="http://dabblet.com/">Dabblet</a> by <a href="http://twitter.com/leaverou/">@leaverou</a>. It's simple &#038; fast for editing front-end code and sharing it via gists.  The thing that impressed me most was the previewers, the animated pie timer &#038; the measuring rulers in particular.  These helpful little bubbles that pop up when you mouse over a keyword in CSS which give a visual representation of the values.]]></description>
			<content:encoded><![CDATA[<div class="frame media" style="width: 83px"><img src="http://www.yellowshoe.com.au/journal/wp-content/uploads/2012/01/previewer-empty.png"></div>
<p>I poked around until I figured out how Lea created them and I wanted to share because that&#8217;s what we web developers do.</p>
<p><a href="http://dabblet.com/gist/1552038">The bubble itself</a> is made up of 1 element plus two extra pseudo elements for the tick &#038; an overlay with the border and inset shadow.</p>
<pre><code lang="html">&lt;div id="color" class="previewer"&gt;&lt;/div&gt;</code></pre>
<pre><code lang="css">/* Cute little value previewers */
.previewer {
  position: absolute;
  border-radius: 8px;
  box-shadow: 1px 1px 8px rgba(0,0,0,.7);
}
/* tick */
.previewer:before {
  content: '';
  position: absolute;
  bottom: -6px; /* move half the width left to center */
  left: 50%; /* left edge at center */
  width: 12px;
  height: 12px;
  border: inherit;
  margin-left: -6px; /* drag left 6px (half the width) to center */
  background: white;
  transform: rotate(45deg); /* make a square a triangle */
  box-shadow: inherit;
}
/* content canvas of the previewer */
.previewer:after {
  content: '';
  position: absolute;
  /* make edges touch parent elements, match dimensions */
  top: 0; right: 0; bottom: 0; left: 0;
  border: 5px solid white;
  border-radius: inherit;
  box-shadow: 1px 1px 5px rgba(0,0,0,.5) inset;
}</code></pre>
<p>I&#8217;m only going to break down two of the previewers that were particularly interesting to me.</p>
<div class="frame media" style="width: 136px"><img src="http://www.yellowshoe.com.au/journal/wp-content/uploads/2012/01/ruler1.png"></div>
<h2>#abslength</h2>
<p><a href="http://dabblet.com/gist/1552071">This little ruler</a> is created with a devilish combination of gradients, Lea explained how to <a href="http://24ways.org/2011/css3-patterns-explained">create CSS3 patterns</a> recently in her 24ways article which explains it all better than I can.</p>
<p>There&#8217;s two main repeating gradients used to create the effect, one 20px wide, the other 5px which overlap and give the effect of the measuring stick.  The background-size property sets the height of the ticks in the ruler.</p>
<pre><code lang="html">&lt;div id="abslength" class="previewer"&gt;&lt;/div&gt;</code></pre>
<pre><code lang="css">#abslength {
  max-width: 100%;
  height: 20px;
  border: 1px solid white;
  border-radius: 0;
  transition: .3s;
  transition-property: width;
}
#abslength:before {
  bottom: -7px;
  background:
    url(noise.png),
    linear-gradient(-45deg,
      hsla(200, 10%, 20%, 0) 47%,
      hsl(200, 10%, 20%) 48%);
}
#abslength:after {
  border: 0;
  background:
    repeating-linear-gradient(left,
      transparent,
      transparent 19px,
      rgba(255,255,255,.6) 19px,
      rgba(255,255,255,.6) 20px)
      left top no-repeat,
    repeating-linear-gradient(left,
      transparent,
      transparent 4px,
      rgba(255,255,255,.4) 4px,
      rgba(255,255,255,.4) 5px)
      left top no-repeat,
    url(noise.png),
    linear-gradient(
      hsla(200, 10%, 20%, .8),
      hsl(200, 10%, 20%));
  background-size: 100% 10px, 100% 5px, auto, auto;
  box-shadow: none;
}</code></pre>
<div class="frame media" style="width: 101px"><img src="http://www.yellowshoe.com.au/journal/wp-content/uploads/2012/01/time.png"></div>
<h2>#time</h2>
<p><a href="http://dabblet.com/gist/1552101">This little guy</a> took the cake for me.  The same old previewer is used but the border-radius is bumped right up to make a circle, the animated timer itself is pure SVG with animated values.  I love seeing a mix of SVG &#038; CSS to create something simple, easily readable and flexible.</p>
<p>The pie shapes can be created with a combination of the stroke-dasharray &#038; stroke-dashoffset properties on the &lt;circle&gt; element.  After a bit of trial and error I was able to find a combination that produced the desired effect.</p>
<pre><code lang="html">&lt;div id="time" class="previewer"&gt;
  &lt;svg&gt;
    &lt;circle r="15.9" cy="32" cx="32" stroke-dasharray="100" transform="rotate(-90) translate(-64 0)"&gt;
      &lt;animate repeatCount="indefinite" dur="2s" values="-100;-300" attributeName="stroke-dashoffset" /&gt;
    &lt;/circle&gt;
  &lt;/svg&gt;
&lt;/div&gt;</code></pre>
<pre><code lang="css">#time {
  width: 74px;
  height: 74px;
  margin-left: -37px;
  background: linear-gradient(right,
    hsla(24, 20%, 95%, .4),
    hsl(24, 20%, 95%) 95%);
  /* half the width/height for a perfect circle */
  border-radius: 37px;
}
#time:before {
  bottom: -4px;
}
#time:after {
  background: url(noise.png);
  z-index: 2;
}
.previewer > svg {
  display: block;
  z-index: 1;
  position: relative;
}
#time > svg {
  margin: 5px;
  width: 64px;
  height: 64px;
  border-radius: 32px;
  background: inherit;
  transform: rotate(-90deg);
}
#time circle {
  stroke: hsl(200, 10%, 20%);
  stroke-opacity: .9;
  fill: transparent;
  /* just shy of width to prevent clipping */
  stroke-width: 31.8;
}</code></pre>
<p>I&#8217;ve always been a big fan of <a href="http://raphaeljs.com/">Raphael.js</a> for creating SVG / VML making it work all the way down to IE6.  Seeing how SVG has been adopted in IE9 now and this is being heavily pushed it makes sense to figure out how to write SVG directly without a js abstraction.</p>
<p>SVG is certainly a useful tool in the box when needed.  Javascript only plays the role of the puppeteer for these previewers in Dabblet, tweaking the values and making it come to life.<br />
In this production, the mix of CSS3 properties (gradients, shadows, generated content, transitions) &#038; SVG are the real stars.</p>
<h2>Other things I&#8217;ve borrowed</h2>
<p>Apart from learning some cool new uses of CSS gradients and more about SVG I&#8217;ve also copied and hacked <a href="https://github.com/LeaVerou/dabblet/blob/master/code/code-highlight.js">code-highlight.js</a> &#038; <a href="https://github.com/LeaVerou/prefixfree">prefix-free.js</a> for use on this site.  <strong>This is why I love open source.</strong></p>
<h2>That&#8217;s all for now</h2>
<p>I hope you found something in there that you can use in your own projects, I know I did.</p>
<p><strong>Thanks Lea!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yellowshoe.com.au/journal/dabblet-previewers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

