<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Andy Li’s Blog - experiment</title><link href="https://blog.onthewings.net/" rel="alternate"></link><link href="http://feeds.feedburner.com/tag/experiment/feed/atom.xml" rel="self"></link><id>https://blog.onthewings.net/</id><updated>2012-03-04T22:19:00+08:00</updated><entry><title>Head-tracking motion-parallax 3D in haXe/Flash</title><link href="https://blog.onthewings.net/2012/03/04/head-tracking-motion-parallax-3d-in-haxe-flash/" rel="alternate"></link><published>2012-03-04T22:19:00+08:00</published><updated>2012-03-04T22:19:00+08:00</updated><author><name>Andy Li</name></author><id>tag:blog.onthewings.net,2012-03-04:/2012/03/04/head-tracking-motion-parallax-3d-in-haxe-flash/</id><summary type="html">&lt;iframe allowfullscreen="" class="video" frameborder="0" height="390" src="//www.youtube.com/embed/U6PePKJHOSw" width="640"&gt;&lt;/iframe&gt;
&lt;p&gt;Here above is my haXe implementation of head-tracking 3D, creating
motion-parallax effect using Away3D 4. You can play with the &lt;a href="http://andyli.github.com/MotionParallaxDemo/"&gt;live
demo&lt;/a&gt; or &lt;a href="https://github.com/andyli/MotionParallaxDemo"&gt;grab the source&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This type of head tracking &lt;span class="caps"&gt;VR&lt;/span&gt; has been around for quite a long time. The
first popular one should be &lt;a href="http://www.youtube.com/watch?v=Jd3-eiid-Uw"&gt;Johnny Lee’s Wiimote …&lt;/a&gt;&lt;/p&gt;</summary><content type="html">&lt;iframe allowfullscreen="" class="video" frameborder="0" height="390" src="//www.youtube.com/embed/U6PePKJHOSw" width="640"&gt;&lt;/iframe&gt;
&lt;p&gt;Here above is my haXe implementation of head-tracking 3D, creating
motion-parallax effect using Away3D 4. You can play with the &lt;a href="http://andyli.github.com/MotionParallaxDemo/"&gt;live
demo&lt;/a&gt; or &lt;a href="https://github.com/andyli/MotionParallaxDemo"&gt;grab the source&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This type of head tracking &lt;span class="caps"&gt;VR&lt;/span&gt; has been around for quite a long time. The
first popular one should be &lt;a href="http://www.youtube.com/watch?v=Jd3-eiid-Uw"&gt;Johnny Lee’s Wiimote hack&lt;/a&gt;, back in 2007,
 built in C# running as a desktop app. Two years later it appeared in
the browser, &lt;a href="http://ricardocabello.com/blog/post/643"&gt;a Flash version made by Mr. doob&lt;/a&gt;. But it was merely a
hack and far from accurate comparing to Johnny Lee’s. Boffswana also
created &lt;a href="http://www.boffswana.com/news/?p=498"&gt;one&lt;/a&gt; in the same year (2009), and then &lt;a href="http://www.boffswana.com/news/?p=950"&gt;an improved one&lt;/a&gt;
with better head tracking algorithm. Sadly Boffswana hasn’t release the source.&lt;/p&gt;
&lt;p&gt;Head tracking and camera movement is relatively simple, since there are
so many libs for these. The tricky part is the perspective
projection matrix. The projection point (the head), unlike most of the
implementation assumption, isn’t always perpendicular to the projection
surface (screen).&lt;/p&gt;
&lt;p&gt;Simplest implementation would ignore the problem. It places a camera at
the position of viewer’s head and render it to the screen, like what Mr.
doob did. The problem is illustrated below.&lt;/p&gt;
&lt;p&gt;When viewer’s head is perpendicular to the screen, everything is
perfectly aligned:&lt;/p&gt;
&lt;p&gt;&lt;img alt="when head is perpendicular to screen" src="/files/2012/animated.79104.gif"/&gt;&lt;/p&gt;
&lt;p&gt;However, when the viewer moves, for example to the left, there is
misalignment of the rendering on screen and the “actual” position of the
virtual object:&lt;/p&gt;
&lt;p&gt;&lt;img alt="when viewer moved to left" src="/files/2012/animated.61275.gif"/&gt;&lt;/p&gt;
&lt;p&gt;Knowing little about C#, it is hard for me to dig out Johnny Lee’s
matrix code. I found the suitable code form the paper “Generalized
Perspective Projection” from &lt;a href="http://csc.lsu.edu/~kooima/misc.html"&gt;Robert Kooima&lt;/a&gt;. It is written in C++,
but translating it to haXe isn’t hard, just remember matrix in OpenGL is
&lt;a href="http://en.wikipedia.org/wiki/Row-major_order#Column-major_order"&gt;column-major order&lt;/a&gt; but Flash’s is &lt;a href="http://en.wikipedia.org/wiki/Row-major_order#Row-major_order"&gt;row-major order&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Head-detection is done using &lt;a href="http://code.google.com/r/andy-hxmarilena/"&gt;my fork&lt;/a&gt; of &lt;a href="http://code.google.com/p/hxmarilena/"&gt;hxmarilena&lt;/a&gt;. My fork is
simply some &lt;span class="caps"&gt;API&lt;/span&gt; changes and switching the &lt;span class="caps"&gt;XML&lt;/span&gt; parsing from
&lt;a href="http://haxe.org/api/flash9/xml/xml"&gt;flash.xml.&lt;span class="caps"&gt;XML&lt;/span&gt;&lt;/a&gt; to &lt;a href="http://haxe.org/api/xml"&gt;Xml&lt;/a&gt; so it may be used in C++ target in the
future. In order to reduce jittering, I’ve included a simple optical
flow tracking on the head. It is a block-matching process applied to
four points on previous head detection result. The optical flow tracking
result is merged to head-detection result by a ratio. It improved a bit,
but I guess to address the problem it is better to port some better
algorithms, like &lt;a href="http://web.mac.com/jsaragih/FaceTracker/FaceTracker.html"&gt;FaceTracker&lt;/a&gt;, in the future.&lt;/p&gt;
&lt;p&gt;Finally, remember you can play with the &lt;a href="http://andyli.github.com/MotionParallaxDemo/"&gt;live demo&lt;/a&gt; and &lt;a href="https://github.com/andyli/MotionParallaxDemo"&gt;it is open
source&lt;/a&gt;.&lt;/p&gt;</content><category term="3D"></category><category term="experiment"></category><category term="Flash"></category><category term="Haxe"></category></entry><entry><title>Chroma key and thresholding in Flash (Pixel Bender), revised</title><link href="https://blog.onthewings.net/2009/12/10/chroma-key-and-thresholding-in-flash-pixel-bender-revised/" rel="alternate"></link><published>2009-12-10T18:12:00+08:00</published><updated>2009-12-10T18:12:00+08:00</updated><author><name>Andy Li</name></author><id>tag:blog.onthewings.net,2009-12-10:/2009/12/10/chroma-key-and-thresholding-in-flash-pixel-bender-revised/</id><summary type="html">&lt;p&gt;&lt;img alt="yellowFiltered" src="/files/2009/yellowFiltered.png" title="yellowFiltered"/&gt;&lt;/p&gt;
&lt;h3&gt;&lt;a href="/files/2009/chromaKey.html"&gt;Demo&lt;/a&gt; (Click to toggle filter)&lt;/h3&gt;
&lt;p&gt;&lt;a href="/files/2009/chromaKey.zip"&gt;source (Flex project including pbk)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I have been very busy since the last few weeks… so the chroma key
filter was put aside for a long time until today :)&lt;/p&gt;
&lt;p&gt;I have used conditional compile in the filter to avoid having if-else in
the runtime, hopefully …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="yellowFiltered" src="/files/2009/yellowFiltered.png" title="yellowFiltered"/&gt;&lt;/p&gt;
&lt;h3&gt;&lt;a href="/files/2009/chromaKey.html"&gt;Demo&lt;/a&gt; (Click to toggle filter)&lt;/h3&gt;
&lt;p&gt;&lt;a href="/files/2009/chromaKey.zip"&gt;source (Flex project including pbk)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I have been very busy since the last few weeks… so the chroma key
filter was put aside for a long time until today :)&lt;/p&gt;
&lt;p&gt;I have used conditional compile in the filter to avoid having if-else in
the runtime, hopefully can increase performance… Anyone volunteer to
measure it and post the different?&lt;/p&gt;</content><category term="experiment"></category><category term="Flash"></category><category term="Pixel Bender"></category></entry><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><entry><title>AS3/JS string concatenation methods performance test</title><link href="https://blog.onthewings.net/2009/10/09/as3-js-string-concatenation-methods-performace-test/" rel="alternate"></link><published>2009-10-09T23:25:00+08:00</published><updated>2009-10-09T23:25:00+08:00</updated><author><name>Andy Li</name></author><id>tag:blog.onthewings.net,2009-10-09:/2009/10/09/as3-js-string-concatenation-methods-performace-test/</id><summary type="html">&lt;p&gt;When writing &lt;a href="https://blog.onthewings.net/2009/10/08/brainflash-the-as3-brainfuck-interpreter/"&gt;BrainFlash&lt;/a&gt;, I was thinking if the string concatenations
for program output will slow down the whole interpreter. That is because
I was once hit that a year ago when dealing with &lt;span class="caps"&gt;XML&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;I asked for better handling methods over &lt;a href="http://stackoverflow.com/questions/1536260/string-concatenation-is-extremly-slow-when-input-is-large"&gt;StackOverflow&lt;/a&gt;. It is
interesting that some of the answers …&lt;/p&gt;</summary><content type="html">&lt;p&gt;When writing &lt;a href="https://blog.onthewings.net/2009/10/08/brainflash-the-as3-brainfuck-interpreter/"&gt;BrainFlash&lt;/a&gt;, I was thinking if the string concatenations
for program output will slow down the whole interpreter. That is because
I was once hit that a year ago when dealing with &lt;span class="caps"&gt;XML&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;I asked for better handling methods over &lt;a href="http://stackoverflow.com/questions/1536260/string-concatenation-is-extremly-slow-when-input-is-large"&gt;StackOverflow&lt;/a&gt;. It is
interesting that some of the answers shown that using “+=” is already
the fastest. But I still want to know more about that, so I wrote my own
simple testing program, which is below:&lt;/p&gt;
&lt;h3&gt;ActionScript version&lt;/h3&gt;
&lt;p&gt;&lt;object data="/files/2009/test.swf" height="400" id="swf0a0b1" style="visibility: visible;" type="application/x-shockwave-flash" width="600"&gt;&lt;param name="wmode" value="opaque"/&gt;&lt;param name="menu" value="true"/&gt;&lt;param name="quality" value="high"/&gt;&lt;param name="bgcolor" value="#FFFFFF"/&gt;&lt;param name="allowScriptAccess" value="always"/&gt;&lt;param name="allowFullScreen" value="true"/&gt;&lt;/object&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2009/test.zip"&gt;source code&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Methods used are:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;str += concateString;&lt;/li&gt;
&lt;li&gt;str = str.concat(concateString);&lt;/li&gt;
&lt;li&gt;array.push(concateString); … str = array.join(“”);&lt;/li&gt;
&lt;li&gt;vector.push(concateString); … str = vector.join(“”);&lt;/li&gt;
&lt;li&gt;byteArray.writeUTFBytes(concateString); … str = byteArray.readUTFBytes(byteArray.length);&lt;/li&gt;
&lt;li&gt;byteArray.writeMultiByte(concateString,”us-ascii”); … str = byteArray.readMultiByte(str.length,”us-ascii”);&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The result shows that fastest method is using &lt;code&gt;+=&lt;/code&gt;, but using
Array/Vector is still very close to it. Using ByteArray is slow and with
&lt;span class="caps"&gt;ASCII&lt;/span&gt; instead of &lt;span class="caps"&gt;UTF&lt;/span&gt;-8 is even slower…&lt;/p&gt;
&lt;p&gt;And all the methods are performed reasonably fast, what is slow is when
showing the resulting string on TextArea… It takes a few seconds! But
when it is drawn, run it again and it will become normal speed, maybe
there is some caching?&lt;/p&gt;
&lt;h3&gt;JavaScript version&lt;/h3&gt;
&lt;p&gt;I coded a JavaScript port too. &lt;a href="/files/2009/string-concatenation-methods-performace-test.html"&gt;See it here.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Methods used are:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;str += concateString;&lt;/li&gt;
&lt;li&gt;str = str.concat(concateString);&lt;/li&gt;
&lt;li&gt;array.push(concateString); … str = array.join(“”);&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Interesting enough, the result is very similar to &lt;span class="caps"&gt;AS3&lt;/span&gt;. It is the
opposite of what we believe using the Array trick will let it performs
faster. &lt;code&gt;+=&lt;/code&gt; is the fastest in most cases, if not, that’s not much difference.&lt;/p&gt;
&lt;p&gt;I’ve only tested in &lt;span class="caps"&gt;IE8&lt;/span&gt;(Win), Firefox 3 (Win/Mac), Safari 4 (Win/Mac),
Chrome 3 (Win). The really really really interesting part is in Chrome
3, using the concat method of String is x7000 &lt;span class="caps"&gt;SLOWER&lt;/span&gt; than the other
two!! What are your results?&lt;/p&gt;</content><category term="experiment"></category><category term="Flash"></category><category term="JavaScript"></category></entry><entry><title>BrainFlash, the AS3 BrainFuck interpreter</title><link href="https://blog.onthewings.net/2009/10/08/brainflash-the-as3-brainfuck-interpreter/" rel="alternate"></link><published>2009-10-08T03:11:00+08:00</published><updated>2009-10-08T03:11:00+08:00</updated><author><name>Andy Li</name></author><id>tag:blog.onthewings.net,2009-10-08:/2009/10/08/brainflash-the-as3-brainfuck-interpreter/</id><summary type="html">&lt;p&gt;If you haven’t heard about &lt;a href="http://www.muppetlabs.com/~breadbox/bf/"&gt;Brainfuck&lt;/a&gt; yet, it is a famous esoteric
programming language. If you want to know why it has such a name take a
look at its hello-world program source code (from &lt;a href="http://en.wikipedia.org/wiki/Brainfuck#Hello_World.21"&gt;Wikipedia&lt;/a&gt;):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nb"&gt;+++&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nb"&gt;+++&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nb"&gt;+++&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nb"&gt;+&lt;/span&gt;&lt;span class="c"&gt;           initialize counter (cell #0) to 10&lt;/span&gt;
&lt;span class="k"&gt;[&lt;/span&gt;&lt;span class="c"&gt;                       use loop to set the next four …&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;If you haven’t heard about &lt;a href="http://www.muppetlabs.com/~breadbox/bf/"&gt;Brainfuck&lt;/a&gt; yet, it is a famous esoteric
programming language. If you want to know why it has such a name take a
look at its hello-world program source code (from &lt;a href="http://en.wikipedia.org/wiki/Brainfuck#Hello_World.21"&gt;Wikipedia&lt;/a&gt;):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nb"&gt;+++&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nb"&gt;+++&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nb"&gt;+++&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nb"&gt;+&lt;/span&gt;&lt;span class="c"&gt;           initialize counter (cell #0) to 10&lt;/span&gt;
&lt;span class="k"&gt;[&lt;/span&gt;&lt;span class="c"&gt;                       use loop to set the next four cells to 70/100/30/10&lt;/span&gt;
&lt;span class="c"&gt;    &lt;/span&gt;&lt;span class="nv"&gt;&amp;gt;&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nb"&gt;+++&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nb"&gt;+++&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nb"&gt;+&lt;/span&gt;&lt;span class="c"&gt;             add  7 to cell #1&lt;/span&gt;
&lt;span class="c"&gt;    &lt;/span&gt;&lt;span class="nv"&gt;&amp;gt;&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nb"&gt;+++&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nb"&gt;+++&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nb"&gt;+++&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nb"&gt;+&lt;/span&gt;&lt;span class="c"&gt;         add 10 to cell #2&lt;/span&gt;
&lt;span class="c"&gt;    &lt;/span&gt;&lt;span class="nv"&gt;&amp;gt;&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nb"&gt;+++&lt;/span&gt;&lt;span class="c"&gt;                   add  3 to cell #3&lt;/span&gt;
&lt;span class="c"&gt;    &lt;/span&gt;&lt;span class="nv"&gt;&amp;gt;&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nb"&gt;+&lt;/span&gt;&lt;span class="c"&gt;                     add  1 to cell #4&lt;/span&gt;
&lt;span class="c"&gt;    &lt;/span&gt;&lt;span class="nv"&gt;&amp;lt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nv"&gt;&amp;lt;&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nb"&gt;-&lt;/span&gt;&lt;span class="c"&gt;                 decrement counter (cell #0)&lt;/span&gt;
&lt;span class="k"&gt;]&lt;/span&gt;&lt;span class="c"&gt;&lt;/span&gt;
&lt;span class="nv"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;++&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;&lt;span class="c"&gt;                   print 'H'&lt;/span&gt;
&lt;span class="nv"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;+&lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;&lt;span class="c"&gt;                     print 'e'&lt;/span&gt;
&lt;span class="nb"&gt;+++&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nb"&gt;+++&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nb"&gt;+&lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;&lt;span class="c"&gt;              print 'l'&lt;/span&gt;
&lt;span class="nt"&gt;.&lt;/span&gt;&lt;span class="c"&gt;                       print 'l'&lt;/span&gt;
&lt;span class="nb"&gt;+++&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;&lt;span class="c"&gt;                   print 'o'&lt;/span&gt;
&lt;span class="nv"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;++&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;&lt;span class="c"&gt;                   print ' '&lt;/span&gt;
&lt;span class="nv"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="nb"&gt;+&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nb"&gt;+++&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nb"&gt;+++&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nb"&gt;+++&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nb"&gt;+++&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nb"&gt;++&lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;&lt;span class="c"&gt; print 'W'&lt;/span&gt;
&lt;span class="nv"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;&lt;span class="c"&gt;                      print 'o'&lt;/span&gt;
&lt;span class="nb"&gt;+++&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;&lt;span class="c"&gt;                   print 'r'&lt;/span&gt;
&lt;span class="nb"&gt;---&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nb"&gt;---&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;&lt;span class="c"&gt;               print 'l'&lt;/span&gt;
&lt;span class="nb"&gt;---&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nb"&gt;---&lt;/span&gt;&lt;span class="c"&gt; &lt;/span&gt;&lt;span class="nb"&gt;--&lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;&lt;span class="c"&gt;             print 'd'&lt;/span&gt;
&lt;span class="nv"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;+&lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;&lt;span class="c"&gt;                     print '!'&lt;/span&gt;
&lt;span class="nv"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;&lt;span class="c"&gt;                      print '\n'&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;the above program can be written as:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nb"&gt;++++++++++&lt;/span&gt;&lt;span class="k"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;+++++++&lt;/span&gt;&lt;span class="nv"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;++++++++++&lt;/span&gt;&lt;span class="nv"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;+++&lt;/span&gt;&lt;span class="nv"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;+&lt;/span&gt;&lt;span class="nv"&gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="nb"&gt;-&lt;/span&gt;&lt;span class="k"&gt;]&lt;/span&gt;&lt;span class="nv"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;++&lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;+&lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;+++++++&lt;/span&gt;&lt;span class="nt"&gt;..&lt;/span&gt;&lt;span class="nb"&gt;+++&lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;++&lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="nb"&gt;+++++++++++++++&lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;+++&lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;------&lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;--------&lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;+&lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;&lt;span class="c"&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;So now you should know how lovely the language is and why I need to
write a interpreter in Flash: now you can manipulate a ByteArray with
BrainFuck code!!! And ya, the name of my interpreter is even more
friendly than the language’s name! :)&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2009/brainflashDemo.html"&gt;Here is the result demo&lt;/a&gt; (&lt;a href="/files/2009/brainflashDemo.zip"&gt;source code here&lt;/a&gt;), type in a program
and its input then click run. The default program is to add up two
single-digit integers. And the output is correct only if the sum is
single-digit too. And again the code is from Wikipedia. You may find
other BrainFuck source code to test from &lt;a href="http://esoteric.sange.fi/brainfuck/bf-source/prog/"&gt;Panu Kalliokoski’s Brainfuck
Archive&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The interpreter is written by only looking at its command description.
There are some bugs as I know. For example when inputting multiple
lines, the output may have wrong formatting. And it can not have dynamic
input like having inputs in a infinite loop. Actually any infinite loop
will freeze your browser.&lt;/p&gt;
&lt;p&gt;I don’t think I will go to improve it anytime soon. So please, don’t use
it in production (will anyone??).&lt;/p&gt;</content><category term="experiment"></category><category term="Flash"></category></entry><entry><title>Playing with chroma key and thresholding in Flash (with Pixel Bender)</title><link href="https://blog.onthewings.net/2009/08/18/playing-with-chroma-key-and-thresholding-in-flash-with-pixel-bender/" rel="alternate"></link><published>2009-08-18T06:22:00+08:00</published><updated>2009-08-18T06:22:00+08:00</updated><author><name>Andy Li</name></author><id>tag:blog.onthewings.net,2009-08-18:/2009/08/18/playing-with-chroma-key-and-thresholding-in-flash-with-pixel-bender/</id><summary type="html">&lt;p&gt;While &lt;a href="http://www.flickr.com/photos/andy-li/sets/72157621818199411/"&gt;traveling with my gf in Europe&lt;/a&gt;, I’m planning to develop a
better technique to use color marker in FLARtoolkit (which I’ve &lt;a href="https://blog.onthewings.net/2009/05/23/flartoolkit-trick-use-a-colored-marker/"&gt;tried
before&lt;/a&gt;).&lt;/p&gt;
&lt;iframe allowfullscreen="" frameborder="0" height="390" src="//www.youtube.com/embed/coDZ7VUogh4" width="640"&gt;&lt;/iframe&gt;
&lt;p&gt;For the first step of doing so is to find a algorithm of matching
colors. Using blend mode “difference” on the image is not …&lt;/p&gt;</summary><content type="html">&lt;p&gt;While &lt;a href="http://www.flickr.com/photos/andy-li/sets/72157621818199411/"&gt;traveling with my gf in Europe&lt;/a&gt;, I’m planning to develop a
better technique to use color marker in FLARtoolkit (which I’ve &lt;a href="https://blog.onthewings.net/2009/05/23/flartoolkit-trick-use-a-colored-marker/"&gt;tried
before&lt;/a&gt;).&lt;/p&gt;
&lt;iframe allowfullscreen="" frameborder="0" height="390" src="//www.youtube.com/embed/coDZ7VUogh4" width="640"&gt;&lt;/iframe&gt;
&lt;p&gt;For the first step of doing so is to find a algorithm of matching
colors. Using blend mode “difference” on the image is not flexible and
may not fit all situations. I decided to calculate the difference by
comparing hue, saturation and brightness of the colors and then
threshold the image.&lt;/p&gt;
&lt;p&gt;This is very similar to (if not exactly) doing &lt;a href="http://en.wikipedia.org/wiki/Chroma_key"&gt;chroma key&lt;/a&gt;. Maybe
there is some awesome beautiful chroma key algorithm but I can’t find a
fast and flexible enough to do so. If you know one, please tell me. :)&lt;/p&gt;
&lt;p&gt;One problem I faced is choosing between color space models. &lt;span class="caps"&gt;RGB&lt;/span&gt; surely
wouldn’t be the choice since it do not give hue value directly. There
are &lt;span class="caps"&gt;HSV&lt;/span&gt; and &lt;span class="caps"&gt;HSL&lt;/span&gt; I found to be quite suitable. The two models share the
same algorithm to calculate hue but have different ones for saturation
and brightness. After reading the &lt;a href="http://en.wikipedia.org/wiki/HSL_and_HSV"&gt;algorithms&lt;/a&gt;, my decision is… try
both. :P&lt;/p&gt;
&lt;p&gt;Another problem is how to preform thresholding. First method is after
calculating the pixel difference, add the difference in hue, saturation
and brightness altogether with weightings and do a one-time threshold to
the grayscale image. Second method is calculate the difference and give
threshold limits to the three channels (H,S,V or H,S,L), only the pixels
pass all the three thresholds will be white. First method should be more
easily to incorporate with other filters developed for &lt;span class="caps"&gt;AR&lt;/span&gt; (like the very
hot &lt;a href="http://blog.inspirit.ru/?p=322"&gt;adaptive thresholding&lt;/a&gt;), but the second method can be more
precise.  Finally I tried both too…&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: large;"&gt;&lt;strong&gt;&lt;a href="/files/2009/colorDifference.html"&gt;Here is the result&lt;/a&gt;&lt;/strong&gt;&lt;/span&gt;. While
I have set some default values to the filters, be sure to play around
with the values when you change the target color. There wouldn’t be a
set of values that fits all methods and situations. :)&lt;/p&gt;
&lt;p&gt;I’ll try integrate it with FLARtoolkit and release the source when it is
ready, be sure to check back soon. :)&lt;/p&gt;
&lt;p&gt;Update:&lt;br/&gt;
&lt;a href="https://blog.onthewings.net/2009/12/10/chroma-key-and-thresholding-in-flash-pixel-bender-revised/"&gt;Source and new demo is here!&lt;/a&gt;&lt;/p&gt;</content><category term="experiment"></category><category term="Flash"></category><category term="Flex"></category><category term="Pixel Bender"></category></entry><entry><title>Simulating atomic model of metal by Box2DFlash</title><link href="https://blog.onthewings.net/2009/07/14/simulating-atomic-model-of-metal-by-box2dflash/" rel="alternate"></link><published>2009-07-14T01:49:00+08:00</published><updated>2009-07-14T01:49:00+08:00</updated><author><name>Andy Li</name></author><id>tag:blog.onthewings.net,2009-07-14:/2009/07/14/simulating-atomic-model-of-metal-by-box2dflash/</id><summary type="html">&lt;iframe allowfullscreen="" frameborder="0" height="480" mozallowfullscreen="" msallowfullscreen="" oallowfullscreen="" src="https://www.flickr.com/photos/andy-li/3716779279/in/set-72157621394341446/player/" webkitallowfullscreen="" width="640"&gt;&lt;/iframe&gt;
&lt;p&gt;Impressed by the video &lt;a href="http://createdigitalmotion.com/2009/07/06/a-different-view-of-particles-real-world-pinscreens/"&gt;here&lt;/a&gt;, I tried to simulate the atomic model of
metal in Flash using Box2DFlash.&lt;/p&gt;
&lt;p&gt;What is done in the program is just put a lot of spheres in the area
randomly, and then let the physics engine to solve all the collisions.
When all the atoms …&lt;/p&gt;</summary><content type="html">&lt;iframe allowfullscreen="" frameborder="0" height="480" mozallowfullscreen="" msallowfullscreen="" oallowfullscreen="" src="https://www.flickr.com/photos/andy-li/3716779279/in/set-72157621394341446/player/" webkitallowfullscreen="" width="640"&gt;&lt;/iframe&gt;
&lt;p&gt;Impressed by the video &lt;a href="http://createdigitalmotion.com/2009/07/06/a-different-view-of-particles-real-world-pinscreens/"&gt;here&lt;/a&gt;, I tried to simulate the atomic model of
metal in Flash using Box2DFlash.&lt;/p&gt;
&lt;p&gt;What is done in the program is just put a lot of spheres in the area
randomly, and then let the physics engine to solve all the collisions.
When all the atoms stop moving, a single still of the metal structure
will be formed.&lt;/p&gt;
&lt;p&gt;The atoms are only drawn on the screen when it is sleeping (i.e.. no
movement). It can save some time from not rendering them in each frame.&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #ff0000;"&gt;caution:&lt;/span&gt; The browser will freeze
for a few seconds after “start” is pressed. And it takes several minutes
to an hour to finish (when sleep count == atom count).  &lt;/p&gt;
&lt;p&gt;&lt;object data="/files/2009/atomicModelSim.swf" height="480" id="swf35721" style="visibility: visible;" type="application/x-shockwave-flash" width="640"&gt;&lt;param name="wmode" value="opaque"/&gt;&lt;param name="menu" value="true"/&gt;&lt;param name="quality" value="high"/&gt;&lt;param name="bgcolor" value="#FFFFFF"/&gt;&lt;param name="allowScriptAccess" value="always"/&gt;&lt;param name="allowFullScreen" value="true"/&gt;&lt;/object&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2009/atomicModelSim.zip"&gt;source&lt;/a&gt;&lt;/p&gt;</content><category term="experiment"></category><category term="Flash"></category><category term="Flex"></category></entry><entry><title>PV3D + Async-threading = Async Render Engine</title><link href="https://blog.onthewings.net/2009/06/07/pv3d-async-threading-asyncrenderengine/" rel="alternate"></link><published>2009-06-07T03:28:00+08:00</published><updated>2009-06-07T03:28:00+08:00</updated><author><name>Andy Li</name></author><id>tag:blog.onthewings.net,2009-06-07:/2009/06/07/pv3d-async-threading-asyncrenderengine/</id><summary type="html">&lt;p&gt;Recently I need to write a 3D tool to help making a installation
artwork. I know I should use Maya, Processing or anything like that, but
in order to get the least risk, I used my most experienced language,
&lt;span class="caps"&gt;AS3&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;Since I need to render A &lt;span class="caps"&gt;LOT&lt;/span&gt; of stuff (\~400 …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Recently I need to write a 3D tool to help making a installation
artwork. I know I should use Maya, Processing or anything like that, but
in order to get the least risk, I used my most experienced language,
&lt;span class="caps"&gt;AS3&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;Since I need to render A &lt;span class="caps"&gt;LOT&lt;/span&gt; of stuff (\~400,000 objects), instantly I
faced the performance issue. As you can imagine, even if I could
generate all the objects in 15 seconds, the rendering process must
excess the Flash Player’s  execution time limit.&lt;/p&gt;
&lt;p&gt;So I try to make my own async render engine with the help of
&lt;a href="http://code.google.com/p/async-threading/"&gt;async-threading&lt;/a&gt;. I extended BasicRenderEngine to
AsyncBasicRenderEngine. The class even has a showBusyCursor property
that let you optionally show the busy cursor on rendering.&lt;/p&gt;
&lt;p&gt;But note that this is only a proof-of-concept and actually has little
help of preventing freeze-screen. It is because I only distribute the
individual 3D object’s rendering to frames but leaving the sorting,
filtering, post-process code unchanged. Also, the RenderStatistics
returned by renderScene/renderLayers will contain only wrong data until
the RENDER_DONE event is dispatched.&lt;/p&gt;
&lt;p&gt;One last thing, Flash’s drawing algorithm seems affecting the async
rendering performance too. So I do not add the viewport to stage.
Instead, once RENDER_DONE, I draw the viewport on a Bitmap on stage.&lt;/p&gt;
&lt;p&gt;&lt;object data="/files/2009/asyncrendererdemo.swf" height="620" id="swf4c3e1" style="visibility: visible;" type="application/x-shockwave-flash" width="820"&gt;&lt;param name="wmode" value="opaque"/&gt;&lt;param name="menu" value="true"/&gt;&lt;param name="quality" value="high"/&gt;&lt;param name="bgcolor" value="#FFFFFF"/&gt;&lt;param name="allowScriptAccess" value="always"/&gt;&lt;param name="allowFullScreen" value="true"/&gt;&lt;/object&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2009/asyncrendererdemo.zip"&gt;source&lt;/a&gt;&lt;/p&gt;</content><category term="experiment"></category><category term="Flash"></category><category term="Flex"></category></entry><entry><title>Vector Sound Wave Morphing</title><link href="https://blog.onthewings.net/2009/05/20/vector-sound-wave-morphing/" rel="alternate"></link><published>2009-05-20T06:53:00+08:00</published><updated>2009-05-20T06:53:00+08:00</updated><author><name>Andy Li</name></author><id>tag:blog.onthewings.net,2009-05-20:/2009/05/20/vector-sound-wave-morphing/</id><summary type="html">&lt;p&gt;This my my final project for the course “Interactivity I”. For this
final project, my aim is to explore the vector nature of sound wave
while making a tool to let people create their own waveform which can
then be saved for other use.&lt;/p&gt;
&lt;p&gt;The waveform in the program consists …&lt;/p&gt;</summary><content type="html">&lt;p&gt;This my my final project for the course “Interactivity I”. For this
final project, my aim is to explore the vector nature of sound wave
while making a tool to let people create their own waveform which can
then be saved for other use.&lt;/p&gt;
&lt;p&gt;The waveform in the program consists of 10 control points. The first
point and the last point are fixed at zero so that the wave can be
looped smoothly to form a sound wave. The controls points can be
adjusted by dragging or by using keyboard. The points are assigned with
keys labelled near them, which are number keys (+shift to move points up
instead of down). I recommend using the keyboard as you may adjust
multiple points at the same time (which feels like using multitouch
surface 8-) ).&lt;/p&gt;
&lt;p&gt;&lt;a href="http://degrafa.org/"&gt;Degrafa&lt;/a&gt; is used to construct the wave form. I choose to use cubic
bezier curve as it is easier for me to implement the algorithm (with the
still-in-beta &lt;a href="http://algorithmist.wordpress.com/2009/01/19/degrafa-cubic-bezier-y-at-x/"&gt;AdvancedCubicBezier&lt;/a&gt; which available via &lt;span class="caps"&gt;SVN&lt;/span&gt;).&lt;/p&gt;
&lt;p&gt;The 3D cylinder is made by Flash Player 10’s 3D &lt;span class="caps"&gt;API&lt;/span&gt;. It looks quite nice
as similar to landscapes.&lt;/p&gt;
&lt;p&gt;Sound is synthesized dynamically in real-time (with some delay… okay?
;-) ). If you hear some “clicks” or “pops”, try to export the sound
first by clicking on the export button at the bottom-right corner (it
will be in wav format, encoded by the &lt;a href="http://code.google.com/p/popforge/source/browse/trunk/flash/PopforgeLibrary/src/de/popforge/format/wav/WavEncoder.as"&gt;WavEncoder from popforge&lt;/a&gt;) .&lt;/p&gt;
&lt;p&gt;If you hear nothing, you may try to increase the buffer size or use the
export function.&lt;/p&gt;
&lt;p&gt;&lt;object data="/files/2009/vectorsoundwave.swf" height="450" id="swf86781" style="visibility: visible;" type="application/x-shockwave-flash" width="600"&gt;&lt;param name="wmode" value="opaque"/&gt;&lt;param name="menu" value="true"/&gt;&lt;param name="quality" value="high"/&gt;&lt;param name="bgcolor" value="#FFFFFF"/&gt;&lt;param name="allowScriptAccess" value="always"/&gt;&lt;param name="allowFullScreen" value="true"/&gt;&lt;/object&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2009/vectorsoundwave.zip"&gt;source&lt;/a&gt;&lt;/p&gt;</content><category term="3D"></category><category term="CityU"></category><category term="experiment"></category><category term="Flash"></category><category term="Flex"></category></entry><entry><title>Chocolate tree…</title><link href="https://blog.onthewings.net/2008/07/16/chocolate-tree/" rel="alternate"></link><published>2008-07-16T03:14:00+08:00</published><updated>2008-07-16T03:14:00+08:00</updated><author><name>Andy Li</name></author><id>tag:blog.onthewings.net,2008-07-16:/2008/07/16/chocolate-tree/</id><summary type="html">&lt;p&gt;Click below to draw (and redraw).&lt;/p&gt;
&lt;p&gt;&lt;object data="/files/2008/brushstroke_1.swf" height="400" id="swf98151" style="visibility: visible;" type="application/x-shockwave-flash" width="480"&gt;&lt;param name="wmode" value="opaque"/&gt;&lt;param name="menu" value="true"/&gt;&lt;param name="quality" value="high"/&gt;&lt;param name="bgcolor" value="#FFFFFF"/&gt;&lt;param name="allowScriptAccess" value="always"/&gt;&lt;param name="allowFullScreen" value="true"/&gt;&lt;/object&gt;&lt;/p&gt;
&lt;p&gt;Originally, I attempted to make a normal tree trunk, but the result make
me think of chocolate…&lt;/p&gt;
&lt;p&gt;And the performance seems hard to be improve since I’m animating bitmaps…&lt;/p&gt;</summary><content type="html">&lt;p&gt;Click below to draw (and redraw).&lt;/p&gt;
&lt;p&gt;&lt;object data="/files/2008/brushstroke_1.swf" height="400" id="swf98151" style="visibility: visible;" type="application/x-shockwave-flash" width="480"&gt;&lt;param name="wmode" value="opaque"/&gt;&lt;param name="menu" value="true"/&gt;&lt;param name="quality" value="high"/&gt;&lt;param name="bgcolor" value="#FFFFFF"/&gt;&lt;param name="allowScriptAccess" value="always"/&gt;&lt;param name="allowFullScreen" value="true"/&gt;&lt;/object&gt;&lt;/p&gt;
&lt;p&gt;Originally, I attempted to make a normal tree trunk, but the result make
me think of chocolate…&lt;/p&gt;
&lt;p&gt;And the performance seems hard to be improve since I’m animating bitmaps…&lt;/p&gt;</content><category term="experiment"></category><category term="Flash"></category></entry></feed>