<?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>Kaizou &#187; css 3</title>
	<atom:link href="http://www.kaizou.org/tag/css-3/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kaizou.org</link>
	<description>This is Web 2.71828</description>
	<lastBuildDate>Thu, 24 Nov 2011 09:34:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Effectively measuring browser framerate using CSS</title>
		<link>http://www.kaizou.org/2011/06/effectively-measuring-browser-framerate-using-css/</link>
		<comments>http://www.kaizou.org/2011/06/effectively-measuring-browser-framerate-using-css/#comments</comments>
		<pubDate>Mon, 27 Jun 2011 12:02:24 +0000</pubDate>
		<dc:creator>David Corvoysier</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Benchmark]]></category>
		<category><![CDATA[css 3]]></category>
		<category><![CDATA[fps]]></category>
		<category><![CDATA[framerate]]></category>
		<category><![CDATA[HTML 5]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://www.kaizou.org/?p=540</guid>
		<description><![CDATA[Most browsers now provides features allowing the web developers to design animated user interfaces that were before only available through proprietary plugins such as Flash or Silverlight. Namely, CSS 3 transformations, transitions and animations, HTML 5 canvas or WebGL are the new kids on the block (for those wondering: yes, I was a teen in [...]]]></description>
			<content:encoded><![CDATA[<p>Most browsers now provides features allowing the web developers to design animated user interfaces that were before only available through proprietary plugins such as Flash or Silverlight.</p>
<p>Namely, CSS 3 transformations, transitions and animations, HTML 5 canvas or WebGL are the new kids on the block (for those wondering: yes, I was a teen in the 80s), and have received a lot of attention since a certain mr jobs claimed that no flash plugin would ever make it to his products.</p>
<p>So: what happens when a browser feature becomes widely implemented and popular ? Competition between implementations, of course !</p>
<p>The trouble is that it may be relatively easy to evaluate javascript performance (although one may argue that event javascript benchmarks are biased), but it is a bit more complicated to evaluate actual browser framerate.</p>
<h2>How browser rendering is implemented</h2>
<p>Typically, and although they may use background processes to perform specific asynchronous tasks (such as resource downloads for instance), web browsers do render each web page in a single thread, splitting the CPU time between javascript and rendering tasks. </p>
<p>Typically, on every frame, the browser executes some javascript functions piled in a javascript code queue (with a priority given on timed functions) for a given amount of time (typically 50ms), and then checks whether the page needs to be refreshed or not. If the page needs to be refreshed (either because, the DOM itself has been modified or because a new CSS rule modifies the layout, or for many other reasons &#8230;), it calculates the new page layout, isolates the portion of the page that it needs to refresh (sometimes called the &#8220;damaged&#8221; or &#8220;dirty&#8221; region), and renders it to its &#8220;backing store&#8221; (typically an internal buffer where all the drawing stuff occurs). Once done, it pushes the modified frame on screen using whatever mechanism the host operating system provides. </p>
<p>The important thing to note here is that ultimately, the operating system video drivers decide when the frame is actually pushed to screen: this means that trying to achieve a framerate that exceeds the video output synchronisation rate (typically 60Hz) is useless. As a matter fo fact, most browsers have a &#8220;framerate cap&#8221; hard-coded somewhere to avoid unecessary rendering operations (Chrome provides an option to remove this cap in about:flags).</p>
<h2>Why javascript alone can&#8217;t be used to calculate FPS</h2>
<p>Since actual frame rendering is not directly related to javascript based DOM or CSS modifications, relying solely on javascript loops to measure an animation framerate will most likely lead to very optimistic results (see for instance the <a href="http://bubblemark.com/dhtml.htm">Bubblemark</a> javascript based benchmark that gives awesome results even when the actual rendering looks completely frozen).</p>
<p>Even worse, with CSS triggered animations, there is no way for the javascript to be notified of a new frame being rendered (actually, the whole point of this new CSS stuff is to avoid the javascript overhead).</p>
<h2>How CSS can be used to calculate FPS (with a little javascript also)</h2>
<p>Having thought a little about this issue, I came up with the idea of using CSS itself to evaluate the actual rendering framerate of a page.</p>
<p>The principle is quite simple:<br />
- insert a very simple CSS animated item in a page,<br />
- calculate the computed position of this item at regular intervals,<br />
- every second that has elapsed, count the number of different positions occupied by the item.    </p>
<p>Pretty dumb, uh ? Well, maybe, but it gives surprisingly accurate results, actually &#8230;</p>
<p>Obviously, this only works on browser supporting CSS transitions/animations, but these are actually the implementations we want to evaluate, so this isn&#8217;t really an issue.</p>
<h2>The FPSMeter script</h2>
<p>I have developed a little script that does just what I&#8217;ve described in the previous paragraph.</p>
<p>Get the script <a href="/code/kaizoumark/FPSMeter.js">Here</a>.</p>
<p>Here is a brief HowTo:</p>
<p>1 &#8211; Include the FPSMeter script to your page</p>
<pre>
<code>    &lt;script type="text/javascript" src="&lt;path_to&gt;/FPSMeter.js"&gt;&lt;/script&gt;</code>
</pre>
<p>2 &#8211; Add two call-back functions to your page to monitor progress and gather the final results</p>
<pre>
<code>function log(fps){
// Do some stuff here with current FPS
}
function end(minfps,avgfps,maxfps){
// Do some other stuff here with min, max and avg fps
}</code>
</pre>
<p>3 &#8211; In your page initialization code, instantiate an FPSMeter object, providing the call-backs as parameters</p>
<pre><code>fpsMeter = new FPSMeter(log,end);</code></pre>
<p>4 &#8211; Run the FPS meter for n seconds</p>
<pre><code>fpsMeter.run(n);</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.kaizou.org/2011/06/effectively-measuring-browser-framerate-using-css/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Pure CSS Bouncing Balls</title>
		<link>http://www.kaizou.org/2011/06/pure-css-bouncing-balls/</link>
		<comments>http://www.kaizou.org/2011/06/pure-css-bouncing-balls/#comments</comments>
		<pubDate>Mon, 27 Jun 2011 08:13:24 +0000</pubDate>
		<dc:creator>David Corvoysier</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Animation]]></category>
		<category><![CDATA[balls]]></category>
		<category><![CDATA[bouncing]]></category>
		<category><![CDATA[css 3]]></category>
		<category><![CDATA[HTML 5]]></category>

		<guid isPermaLink="false">http://www.kaizou.org/?p=528</guid>
		<description><![CDATA[Yet another example of how easy it is to design animations with the new CSS 3 primitives. Click on the picture to see the live version. It works on Chrome, Safari and Firefox.]]></description>
			<content:encoded><![CDATA[<p>Yet another example of how easy it is to design animations with the new CSS 3 primitives.</p>
<p><a href="/code/bouncing-balls"><br />
<img src="/code/bouncing-balls/bouncing-balls.jpg"></img><br />
</a><br />
Click on the picture to see the live version.<br />
It works on Chrome, Safari and Firefox.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kaizou.org/2011/06/pure-css-bouncing-balls/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Pure CSS Carousel</title>
		<link>http://www.kaizou.org/2011/06/pure-css-carousel/</link>
		<comments>http://www.kaizou.org/2011/06/pure-css-carousel/#comments</comments>
		<pubDate>Wed, 22 Jun 2011 20:00:10 +0000</pubDate>
		<dc:creator>David Corvoysier</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[carousel]]></category>
		<category><![CDATA[coverflow]]></category>
		<category><![CDATA[css 3]]></category>
		<category><![CDATA[HTML 5]]></category>

		<guid isPermaLink="false">http://www.kaizou.org/?p=513</guid>
		<description><![CDATA[I have been playing for a while with CSS transitions and animations, but I didn&#8217;t take the time to post anything on the subject. Here is a small example of a pure CSS carousel using CSS3 animations. It works on Chrome, Safari (with a few z-index glitches), and hopefully soon on Firefox 5.0.]]></description>
			<content:encoded><![CDATA[<p>I have been playing for a while with CSS transitions and animations, but I didn&#8217;t take the time to post anything on the subject.<br />
Here is a small example of a pure CSS carousel using CSS3 animations.<br />
<object width="800" height="600" data="/code/carousel" style="overflow:hidden"></object><br />
It works on Chrome, Safari (with a few z-index glitches), and hopefully soon on Firefox 5.0.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kaizou.org/2011/06/pure-css-carousel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kaizoumark: a browser animation benchmark</title>
		<link>http://www.kaizou.org/2011/06/kaizoumark-a-browser-animation-benchmark/</link>
		<comments>http://www.kaizou.org/2011/06/kaizoumark-a-browser-animation-benchmark/#comments</comments>
		<pubDate>Fri, 17 Jun 2011 08:31:21 +0000</pubDate>
		<dc:creator>David Corvoysier</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Animation]]></category>
		<category><![CDATA[Benchmark]]></category>
		<category><![CDATA[css 3]]></category>
		<category><![CDATA[HTML 5]]></category>

		<guid isPermaLink="false">http://www.kaizou.org/?p=483</guid>
		<description><![CDATA[After years of Flash dominance, HTML5 and CSS3 are now bringing many eye-candy features allowing the development of pure-web rich user interfaces (Canvas, CSS animations &#038; transitions, WebGL). At the same time, the development of native applications on smartphones &#038; tablets have raised the users level of expectations towards GUI to a point that &#8220;plain [...]]]></description>
			<content:encoded><![CDATA[<p>After years of Flash dominance, HTML5 and CSS3 are now bringing many eye-candy features allowing the development of pure-web rich user interfaces (Canvas, CSS animations &#038; transitions, WebGL).</p>
<p>At the same time, the development of native applications on smartphones &#038; tablets have raised the users level of expectations towards GUI to a point that &#8220;plain old web&#8221; user interfaces are not an option anymore.</p>
<p>But do current implementations live up to the expectations ? This has yet to be demonstrated &#8230;</p>
<p>The sad truth is that even on desktop, the CPU alone cannot cope with the level of complexity that is today required to develop a fancy user interface, and browser vendors are struggling to take advantage of hardware accelerations provided by blitters or GPUs. Due to the huge diversity of hardware configurations available, this leads to a very fragmented landscape for the poor web developer.</p>
<p>That said, how can we users help things getting better ? By providing feedback on how well their implementation behave to the browser developers &#8230;</p>
<p>For that purpose, I have designed a small browser animation benchmark test that calculates the number of frames the browser is displaying per seconds while an animation plays.</p>
<p>Note: If you want to know how the framerate is evaluated, see <a href="/2011/06/effectively-measuring-browser-framerate-using-css">this post</a>.</p>
<p>It now only works for Firefox, Chrome, Safari and Opera (IE is not supported).</p>
<p>It currently only tests CSS 2D features, but I will add more tests later.</p>
<p>At some point in the future I will also try to add some mechanism to have results gathered in a database, but in the meantime, you can post your result as a comment, specifying your hardware configuration, operating system and browser version.</p>
<p>Click on the link below to benchmark your browser.</p>
<p><a href="/code/kaizoumark" style="font-family: 'Soviet';font-size:30px;background-color:darkorange;border-radius:5px;border:3px solid red"> kaizoumark </a></p>
<p>Some results:</p>
<p>On a Dell Latitude D620 Laptop running Windows XP:</p>
<p>Chrome 13.0.782.24</p>
<table>
<tbody>
<tr>
<td>Test</td>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>CSS 3 Transitions (width+height)</td>
<td>38 fps</td>
<td>38 fps</td>
<td>32 fps</td>
<td>17 fps</td>
</tr>
<tr>
<td>CSS 3 Transitions (width+height+opacity)</td>
<td>38 fps</td>
<td>37 fps</td>
<td>17 fps</td>
<td>8 fps</td>
</tr>
<tr>
<td>CSS 3 Animations (top+left)</td>
<td>38 fps</td>
<td>38 fps</td>
<td>35 fps</td>
<td>16 fps</td>
</tr>
</tbody>
</table>
<p>Firefox 5</p>
<table>
<tbody>
<tr>
<td>Test</td>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>CSS 3 Transitions (width+height)</td>
<td>59 fps</td>
<td>53 fps</td>
<td>26 fps</td>
<td>13 fps</td>
</tr>
<tr>
<td>CSS 3 Transitions (width+height+opacity)</td>
<td>59 fps</td>
<td>33 fps</td>
<td>7 fps</td>
<td>2 fps</td>
</tr>
<tr>
<td>CSS 3 Animations (top+left)</td>
<td>57 fps</td>
<td>49 fps</td>
<td>20 fps</td>
<td>10 fps</td>
</tr>
</tbody>
</table>
<p>Safari 5.0.3</p>
<table>
<tbody>
<tr>
<td>Test</td>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>CSS 3 Transitions (width+height)</td>
<td>40 fps</td>
<td>40 fps</td>
<td>34 fps</td>
<td>19 fps</td>
</tr>
<tr>
<td>CSS 3 Transitions (width+height+opacity)</td>
<td>41 fps</td>
<td>38 fps</td>
<td>12 fps</td>
<td>5 fps</td>
</tr>
<tr>
<td>CSS 3 Animations (top+left)</td>
<td>40 fps</td>
<td>40 fps</td>
<td>36 fps</td>
<td>18 fps</td>
</tr>
</tbody>
</table>
<p>Opera 11.11</p>
<table>
<tbody>
<tr>
<td>Test</td>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>CSS 3 Transitions (width+height)</td>
<td>48 fps</td>
<td>47 fps</td>
<td>46 fps</td>
<td>40 fps</td>
</tr>
<tr>
<td>CSS 3 Transitions (width+height+opacity)</td>
<td>49 fps</td>
<td>47 fps</td>
<td>35 fps</td>
<td>18 fps</td>
</tr>
<tr>
<td>CSS 3 Animations (top+left)</td>
<td>NA</td>
<td>NA</td>
<td>NA</td>
<td>NA</td>
</tr>
</tbody>
</table>
<p>On an Iphone 3GS running iOS 4.3.3:</p>
<table>
<tbody>
<tr>
<td>Test</td>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>CSS 3 Transitions (width+height)</td>
<td>23 fps</td>
<td>22 fps</td>
<td>4 fps</td>
<td>2 fps</td>
</tr>
<tr>
<td>CSS 3 Transitions (width+height+opacity)</td>
<td>31 fps</td>
<td>3 fps</td>
<td>1 fps</td>
<td>1 fps</td>
</tr>
<tr>
<td>CSS 3 Animations (top+left)</td>
<td>18 fps</td>
<td>23 fps</td>
<td>7 fps</td>
<td>3 fps</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.kaizou.org/2011/06/kaizoumark-a-browser-animation-benchmark/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS 3 Web Fonts</title>
		<link>http://www.kaizou.org/2009/06/css-3-web-fonts/</link>
		<comments>http://www.kaizou.org/2009/06/css-3-web-fonts/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 15:23:14 +0000</pubDate>
		<dc:creator>David Corvoysier</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[css 3]]></category>

		<guid isPermaLink="false">http://www.kaizou.org/?p=412</guid>
		<description><![CDATA[Among other cool things, CSS 3.0 finally introduces an old feature that had only been implemented so far using proprietary extensions, and therefore did not receive the attention it deserved: Web Fonts ! As specified in the CSS Fonts Module Level 3 specifications, web developers can insert @font-face CSS rules into their stylesheets to specify [...]]]></description>
			<content:encoded><![CDATA[<p>Among other cool things, CSS 3.0 finally introduces an old feature that had only been implemented so far using proprietary extensions, and therefore did not receive the attention it deserved: Web Fonts !
</p>
<p>
As specified in the <a href="http://www.w3.org/TR/css3-webfonts/">CSS Fonts Module Level 3 specifications</a>, web developers can insert @font-face CSS rules into their stylesheets to specify explicitly the location of the font resource corresponding to a font face specified in that stylesheet, thus allowing a consistent rendering of their site.
</p>
<p>
For instance, I use the &#8220;Soviet&#8221; font family for the title of this blog, but this font is not so common, so I inserted the following code in the site main stylesheet:
</p>
<pre>
<code>@font-face {
  font-family: "Soviet";
  src: url("./fonts/Soviet2.ttf") format("truetype");
}</code>
</pre>
<p>
And in the CSS rule corresponding to the site title:
</p>
<pre>
<code>#header h1#logo-text a {
	position: absolute;
	margin: 0; padding: 0;
	font: 56px <span style="font-weight:bold">'Soviet'</span>, 'Trebuchet MS', Sans-serif;
	letter-spacing: -3px;
	text-decoration: none;
	color: #000;
	top: 58px; left: 300px;
}</code>
</pre>
<p>
This causes compatible web browsers to download the Soviet Font from my site and correctly display the site title.
</p>
<p>
Of course, not many web browsers today support Web Fonts (according to my tests, only <a href="http://nightly.webkit.org/">WebKit nightlies</a> have the correct display), but things will change shortly, as Firefox 3.5 should support them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kaizou.org/2009/06/css-3-web-fonts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

