<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Andy Li’s Blog - CSS</title><link href="https://blog.onthewings.net/" rel="alternate"></link><link href="http://feeds.feedburner.com/tag/css/feed/atom.xml" rel="self"></link><id>https://blog.onthewings.net/</id><updated>2009-11-24T16:35:00+08:00</updated><entry><title>CSS-only experiments</title><link href="https://blog.onthewings.net/2009/11/24/css-only-experiements/" rel="alternate"></link><published>2009-11-24T16:35:00+08:00</published><updated>2009-11-24T16:35:00+08:00</updated><author><name>Andy Li</name></author><id>tag:blog.onthewings.net,2009-11-24:/2009/11/24/css-only-experiements/</id><summary type="html">&lt;p&gt;In the last week I have tried to make some &lt;span class="caps"&gt;CSS&lt;/span&gt;-only experiments.
Originally it’s just an idea to play some effects with &lt;a href="http://webkit.org/blog/138/css-animation/"&gt;&lt;span class="caps"&gt;CSS&lt;/span&gt; animation
which now available in Webkit&lt;/a&gt;. But at the end I am obsessed and
making games with &lt;span class="caps"&gt;CSS&lt;/span&gt;… Yup, that’s embedding game logic in …&lt;/p&gt;</summary><content type="html">&lt;p&gt;In the last week I have tried to make some &lt;span class="caps"&gt;CSS&lt;/span&gt;-only experiments.
Originally it’s just an idea to play some effects with &lt;a href="http://webkit.org/blog/138/css-animation/"&gt;&lt;span class="caps"&gt;CSS&lt;/span&gt; animation
which now available in Webkit&lt;/a&gt;. But at the end I am obsessed and
making games with &lt;span class="caps"&gt;CSS&lt;/span&gt;… Yup, that’s embedding game logic in the place
which designed to be presentation layer only… :P&lt;/p&gt;
&lt;p&gt;Video first, description follows:&lt;/p&gt;
&lt;iframe allowfullscreen="" frameborder="0" height="390" src="//www.youtube.com/embed/ec2pz_GqWEw" width="640"&gt;&lt;/iframe&gt;
&lt;h2&gt;Mouse shadow&lt;/h2&gt;
&lt;p&gt;&lt;img alt='"CSS experiment: Mouse shadow by on_the_wings, on Flickr"' src="http://farm3.staticflickr.com/2777/4129811385_f698cbc966_m.jpg"/&gt; &lt;img alt="CSS experiment: Mouse shadow" src="http://farm3.staticflickr.com/2762/4130576658_4419cd860c_m.jpg"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/wp-content/uploads/2009/11/css-experiment_mouse-shadow.php"&gt;Open experiment&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It works on Webkit browsers only (Chrome, Safari).&lt;/p&gt;
&lt;p&gt;What I want to create is just some old-school shadow, fading etc. Turn
out using a deeply-nested div for the effect is quite stylish. The divs
are assigned to different classes based on their nested level to improve
performance because &lt;code&gt;div &amp;gt; div &amp;gt; div &amp;gt; ...&lt;/code&gt; is just too slow…&lt;/p&gt;
&lt;h2&gt;Gear&lt;/h2&gt;
&lt;p&gt;&lt;img alt='"CSS experiment: Gear by on_the_wings, on Flickr"' src="http://farm3.staticflickr.com/2513/4130576756_d12b7ee3e5_m.jpg"/&gt; &lt;img alt="CSS experiment: Gear" src="http://farm3.staticflickr.com/2694/4129811585_a120478478_m.jpg"/&gt; &lt;img alt="CSS experiment: Gear" src="http://farm3.staticflickr.com/2693/4130576954_19c1d75638_m.jpg"/&gt; &lt;img alt="CSS experiment: Gear" src="http://farm3.staticflickr.com/2771/4130576994_dc6d7c029f_m.jpg"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/wp-content/uploads/2009/11/css-experiment_gear.php"&gt;Open experiment&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Again, works on Webkit browsers only (Chrome, Safari).&lt;/p&gt;
&lt;p&gt;I find the deeply-nested div has quite a potential to make some more
things, so here is another product of it. Swapping the &lt;span class="caps"&gt;CSS&lt;/span&gt; transition
with &lt;span class="caps"&gt;CSS&lt;/span&gt; transform achieved something very similar to &lt;a href="http://en.wikipedia.org/wiki/Fractal"&gt;fractal&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;One little defect is I used percentage for the size of divs and the
rounding number cause some gaps between divs… It is
more noticeable when using resolution 3.&lt;/p&gt;
&lt;h2&gt;Pixel art&lt;/h2&gt;
&lt;p&gt;&lt;img alt='"CSS experiment: Pixel art by on_the_wings, on Flickr"' src="http://farm3.staticflickr.com/2732/4129811095_f867790c2c_m.jpg"/&gt; &lt;img alt="CSS experiment: Pixel art" src="http://farm3.staticflickr.com/2501/4129811141_a80400e2fd_m.jpg"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/wp-content/uploads/2009/11/css-experiment_pixel-art.php"&gt;Open experiment&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This one works on all major browsers (&lt;span class="caps"&gt;IE&lt;/span&gt; 6/7/8, Firefox, Safari, Chrome) :)&lt;/p&gt;
&lt;p&gt;This is a drawing board that you can click to draw pixel.&lt;/p&gt;
&lt;p&gt;I remembered there are hackers tried to get users’ browsing history by
using color-change of visited link. It impressed me to store valued in
the browsing history. Originally I used links with hash values (i.e.. &lt;code&gt;&amp;lt;a
href="#123"&amp;gt;&amp;lt;/a&amp;gt;&lt;/code&gt;) and it works in all the browsers… except &lt;span class="caps"&gt;IE&lt;/span&gt;. &lt;span class="caps"&gt;IE&lt;/span&gt;
will turn the color when you click on it but it does not store it in the
history. So I switched to use &lt;code&gt;iframe&lt;/code&gt;, that is setting the links to
open in the iframe and serve a dummy web page with random &lt;span class="caps"&gt;URL&lt;/span&gt;…&lt;/p&gt;
&lt;h2&gt;Click Challenge&lt;/h2&gt;
&lt;p&gt;&lt;img alt='"CSS experiment: Click Challenge by on_the_wings, on Flickr"' src="http://farm3.staticflickr.com/2505/4130576444_f87eb8b7e4_m.jpg"/&gt; &lt;img alt="CSS experiment: Click Challenge" src="http://farm3.staticflickr.com/2721/4130576522_c6ae207426_m.jpg"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/wp-content/uploads/2009/11/css-experiment_click-challenge.php"&gt;Open experiment&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This one is Webkit browsers only (Chrome, Safari).&lt;/p&gt;
&lt;p&gt;This is the latest experiment I made, which is really a playable game.
&lt;a href="http://webkit.org/blog/324/css-animation-2/"&gt;&lt;span class="caps"&gt;CSS&lt;/span&gt; keyframe animation&lt;/a&gt; is used to simulate a timer. Lots of
identical checkboxes to act as an area to let user clicks on. They are
removed when clicked on it, using &lt;code&gt;:checked&lt;/code&gt; in &lt;span class="caps"&gt;CSS&lt;/span&gt;. Finally a &lt;span class="caps"&gt;CSS&lt;/span&gt;
counter is used to label the checkboxes (actually a ordered list will be fine).&lt;/p&gt;
&lt;hr/&gt;
&lt;p&gt;Update&lt;/p&gt;
&lt;p&gt;2009-11-26: &lt;a href="http://www.chromeexperiments.com/detail/gear/"&gt;Gear is now on Chrome Experiments!&lt;/a&gt; Being the first
&lt;span class="caps"&gt;CSS&lt;/span&gt;-only experiment over there :)&lt;/p&gt;</content><category term="CSS"></category><category term="experiment"></category></entry></feed>