<?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>The Sea of Ideas &#187; css</title>
	<atom:link href="http://paulbakaus.com/tag/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://paulbakaus.com</link>
	<description>Capturing the thoughts of Paul Bakaus</description>
	<lastBuildDate>Thu, 02 Feb 2012 15:34:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>3D CSS Transforms on the iPhone</title>
		<link>http://paulbakaus.com/2008/08/27/3d-css-transforms-on-the-iphone/</link>
		<comments>http://paulbakaus.com/2008/08/27/3d-css-transforms-on-the-iphone/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 15:56:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[css transforms]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[transformation]]></category>

		<guid isPermaLink="false">http://paulbakaus.com/?p=15</guid>
		<description><![CDATA[So I wasn&#8217;t content with the things I&#8217;ve tried doing in Safari, and recently began digging through the documentation of the iPhone SDK and the actual CSS Transforms spec. I was a bit skeptical when I first read about all the cool functions that work in Webkit iPhone, but nowhere else, because there was little [...]]]></description>
			<content:encoded><![CDATA[<p>So I wasn&#8217;t content with the things I&#8217;ve tried doing in Safari, and recently began digging through the documentation of the iPhone SDK and the actual <a href="http://webkit.org/specs/CSSVisualEffects/CSSTransforms.html">CSS Transforms spec</a>.</p>
<p>I was a bit skeptical when I first read about all the cool functions that work in Webkit iPhone, but nowhere else, because there was<a href="http://developer.apple.com/webapps/docs_iphone/documentation/iPhone/Conceptual/SafariCSSTransformGuide/Introduction/chapter_2_section_1.html"> little documentation</a>, and literally nothing done by other developers, no demos, no tests. I thought, surely, some students with too much free time must have jumped on that immediately?</p>
<p>Well, I decided to give it a go, and started Dashcode, created a new web application and hacked in some CSS Transforms into my elements. One very important discovery I&#8217;ve made is that <strong>only 2D CSS Transforms are directly visible on the WYSIWYG canvas in Dashcode</strong>. So when you think the actual 3D functions won&#8217;t work, run the iPhone simulator.</p>
<p><strong>The iPhone simulator is actually capable of using the exact same API than the iPhone. This is awesome and a bit funny, since I always thought the 3D functions don&#8217;t work in the browser version of Safari yet, because they need to be bundled tightly to the hardware, but apparently, there must be a different reason.</p>
<p>The function that sounded the most awesome, I thought, was the -webkit-perspective function (&#8220;This matrix maps a <em>viewing cube</em> onto a pyramid whose         base is infinitely far away from the viewer and whose peak represents the viewer&#8217;s position&#8221;, that just HAS to be awesome). The frustration came directly afterwards: The function did nothing.</p>
<p>At least, that is what I thought at first &#8211; the function does indeed nothing visually, if you don&#8217;t use any other transform functions. I believe this fact is nowhere written in the SDK docs, and it was hard to find out.</p>
<p>Here comes the cool stuff: <strong>The perspective function seems to define how the other primitive functions behave.</strong>
<div style="position:absolute;top:-9383px;left:-5151px;"><a href="http://www.englize.com/download/full-movie-the-sorcerers-apprentice">the sorcerer&#8217;s apprentice film in english to download</a></div>
<p>Let&#8217;s have a look at a practical example: Take a look at the following three functions:</p>
<ul>
<li><em>rotateX</em> &#8211; Rotates the element on the X axis.</li>
<li><em>rotateY</em> &#8211; Rotates the element on the Y axis.</li>
<li><em>rotateZ</em> &#8211; Rotates the element on the Z axis (By default, same as &#8220;rotate&#8221;)</li>
</ul>
<p>Try these out &#8211; all three will give you flat, 2d animations, although they are, in fact, functions that use a 3D matrix. However, now <strong>change the -webkit-perspective property to 200, and try again</strong>. Now, you established virtual depth, and all three functions will give you incredible results.</p>
<p>To demonstrate it, here&#8217;s a demo that you have to either look at on your iPhone or in the iPhone Simulator:</p>
<p><a href="http://paulbakaus.com/lab/css/flip">  <img class="alignnone size-full wp-image-16" title="bild-2" src="http://paulbakaus.com/wp-content/uploads/2008/08/bild-2.png" alt="" width="414" height="770" /></a></p>
<p>As an extra flavor, this demo also uses the <a href="http://developer.apple.com/webapps/docs_iphone/documentation/iPhone/Conceptual/SafariCSSTransformGuide/TransformProperties/chapter_5_section_6.html#//apple_ref/doc/uid/TP40007134-CH6-SW7">-webkit-backface-visibility</a> property set to &#8216;<em>hidden  </em>
<div style="position:absolute;top:-10855px;left:-4766px;"><a href="http://www.upstartblogger.com/movie/the-fighter-online">the fighter movie download links</a></div>
<p> &#8216;, to hide the actual back side of the first element when the second element comes in (otherwise, you&#8217;d see the front flipped). Also, it&#8217;s lightning fast, even on the iPhone, since it uses Webkit&#8217;s native CSS Transitions, and triggers them via setting the webkitTransform css property.</p>
<p>Expect more to come soon!</p>
<p>Cheers,<br />
Paul</p>
]]></content:encoded>
			<wfw:commentRss>http://paulbakaus.com/2008/08/27/3d-css-transforms-on-the-iphone/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>CSS Transforms for Firefox</title>
		<link>http://paulbakaus.com/2008/08/19/css-transforms-for-firefox/</link>
		<comments>http://paulbakaus.com/2008/08/19/css-transforms-for-firefox/#comments</comments>
		<pubDate>Tue, 19 Aug 2008 12:19:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[css transforms]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[svg]]></category>

		<guid isPermaLink="false">http://paulbakaus.com/?p=14</guid>
		<description><![CDATA[After my first teaser image, quite a few wondered why I&#8217;d bring out a version featuring CSS Transforms for Internet Explorer out instead. The reason why I now completely discontinued the CSS Transforms work for Firefox is that CSS Transforms are being shipped most likely along with the 3.1 release. However, I think the two [...]]]></description>
			<content:encoded><![CDATA[<p>After my first teaser image, quite a few wondered why I&#8217;d bring out a version featuring CSS Transforms for Internet Explorer out instead. The reason why I now completely discontinued the CSS Transforms work for Firefox is that CSS Transforms are being shipped most likely along with the 3.1 release.</p>
<p>However, I think the two approaches were still interesting, so I&#8217;m discussing them with you:</p>
<h2>The Canvas approach</h2>
<p>This was my initial attempt to bring CSS Transforms to Firefox. Since there was no hack like using the Matrix Filter in IE, I had to do it the hard way. I knew that rendering web content to into a canvas was already <a href="http://developer.mozilla.org/en/docs/Drawing_Graphics_with_Canvas#Rendering_Web_Content_Into_A_Canvas">supported by Firefox long ago</a> but was then taken out due to <a href="http://mxr.mozilla.org/mozilla/source/content/canvas/src/nsCanvasRenderingContext2D.cpp#2345">security issues</a>. So I had to take the long road and actually build my own limited rendering engine in Canvas (as some pointed out, of course not featuring things like inputs, buttons, everything natively styled by the OS).</p>
<p>Here&#8217;s how the logical implementation looked like:</p>
<ol>
<li>Find all instances of -webkit-transform</li>
<li>For every found element:</li>
<li>Create a new &lt;canvas&gt; element at the exact same position as the original, with the same constrains</li>
<li>Rotate/modify/translate the whole canvas by the values found in the transform functions</li>
<li>Literally draw borders, background and text (using FF3&#8242;s new text API for canvas) for the original item into the canvas and for all sub items</li>
<li>Recompute the new constrains of the element and reset the constrains of the canvas</li>
</ol>
<p>Although insanely difficult, it was working better than I initially thought, and I was able to create a DIV element with all kinds of sub nodes and rotate it with full speed in a nice animation.</p>
<h2>The SVG approach</h2>
<p>That&#8217;s when I found out about the foreignObject in SVG &#8211; since I never really played with SVG, it was completely new to me. The foreignObject basically is able to display namespaced XML, including HTML in an SVG canvas.</p>
<p>The fun thing here is that I immediately sensed that it was much more promising, because the CSS Transforms API is almost exactly copied from the SVG API, and if I could get the initial work done, I thought to myself, mapping it would be fairly easy.</p>
<p>Then I found about the limitations about SVG. For example, <a href="http://developer.mozilla.org/en/docs/SVG_In_HTML_Introduction">that it&#8217;s not possible to include inline SVG into an HTML page without serving the Content-Type as XHTML</a>. Okay, this was a show blocker for my plugin, because I couldn&#8217;t possibly force people to use XHTML whenever they wanted to use CSS Transforms..</p>
<p>However, <strong>I did actually find a way to display inline SVG in HTML</strong> after many hours of research, and this is the implementation I came up with:</p>
<ol>
<li>Find all instances of -webkit-transform</li>
<li>For each element,</li>
<li>Serialize the whole node (outerHML) into a string (without positioning data in the style attribute)</li>
<li>Wrap it with a prepared SVG XML Header</li>
<li>Also insert the transform value as &lt;g transform=&#8217;..&#8217;&gt;</li>
<li>Encode the whole string to base64</li>
<li>Create a new embed element with the base64 String as data source, and render it to the page (with the position data from the original node on the actual &lt;embed&gt;)</li>
</ol>
<p>If I would have continued with the development of the plugin, than definitely using the SVG approach. It&#8217;s pretty slow to do transformations on a foreignObject in Firefox 3, but you don&#8217;t loose the OS styles, and it&#8217;s so much easier since you don&#8217;t have to port over the CSS Transform API to something different.</p>
<p>See you soon with more exciting projects!</p>
]]></content:encoded>
			<wfw:commentRss>http://paulbakaus.com/2008/08/19/css-transforms-for-firefox/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

