Archive

Archive for the ‘Flex’ Category

More Fractal Letters

February 10th, 2009

I’ve continued adding bits to my fractal letters over the past few weeks and have finally finished everything to print out my full e-mail address. The @ symbol was particularly interesting and I think it turned out pretty nice.

fractal_email_11

Fractal Email - first iteration

Fractal Email - third iteration

Fractal Email - third iteration

Fractal Email - fifth iteration

Fractal Email - fifth iteration

The pictures link to the updated app. Enjoy, and as usual, don’t slide the slider up to the max unless you’re willing to wait while your entire browser hangs for several minutes.

Flash, Flex, Fractal , ,

Fractal Letters

January 20th, 2009

On the way home last Thursday I decided to try creating fractal letters. The idea was to replace each “line” in a simple version of a letter with a copy of itself but allow for the aspect ratio of its dimensions to change so that the result is still recognizable as a letter. This is something like an L-system, of which the Dragon curve is one. After a weekend’s worth of work I have what amounts to thirteen different fractal letter algorithms for six different letters. 1 P, 3 A, 2 E, 2 R, 2 C, 3 N. Yes, those spell PAPERCRANE. Here is the first iteration (just the letters).

Fractal Letters, iteration 1

Fractal Letters, iteration 1

And here is the fifth iteration:

Fractal Letters, iteration 5

Fractal Letters, iteration 5

Some letters have variations in how they are drawn or how they repeat, or both (hence the 2 lines). The bottom N uses an algorithm I worked out which didn’t change the aspect ratio and had only one repetition per line. Both of the N variants in the words use two repetitions per line and constrict the width faster than the height, which leaves the N recognizable. The idea here, after all, was to make letters which had a cool fractal look but could still be read.

Click either of the pictures to view the flex app and play with the iterations yourself. Just drag (or click on) the slider on the bottom of the app to change the iteration.

Stay tuned, I have another blog post coming up soon specifically about that N on the bottom, the math required to create the algorithm, and some interesting (and beautiful) results I got when implementing a test program.

AIR, Flash, Flex, FlexBuilder, Fractal, Papervision3D, math , ,

Flex Bug: Icon shadows in a TabNavigator’s Tabs

May 27th, 2008

This is likely a generic problem with anything that uses a Button but I have found this issue with Tabs in a TabNavigator specifically. When you have a TabNavigator with multiple complicated children that take a while to load, clicking one tab then clicking another quickly can lead to a “shadow” icon at the top-left of the tabs. See the bug for more: SDK-15656

Flex , ,

Inverted Mask in Flex

March 17th, 2008

Today I took on the challenge of changing a component I built last year to fit into a new style our creative department just finished for a new website. The previous component had a drawn background and some text laid over it which was a different color. The new style called for the same thing with a different background color and the text cut out of the shape. The different background color was easy, I simply added a few styles (one for rollover too) and had it changing color. The harder part was cutting the text out of the background. I knew that this was possible in graphics programs by inverting the mask used or subtracting the shape from another shape and using that as the mask. I couldn’t find any options in Flex for inverting a mask and a google search provided nothing on inverting a mask. I did, however run into a graphics tricks article on InsideRIA. This reminded me of the blend modes that I’d played with in the San Francisco Papervision3D course.

Curious, I went looking and sure enough there was a BlendMode.INVERT. This didn’t, however, do what I wanted of course. This inverted the color values, not the mask. Looking further I found BlendMode.ERASE. This sounded promising but several iterations had it doing nothing, then showing as normal text, then “erasing” everything underneath it. I didn’t want my text to erase everything, just the shape behind it. After some more playing I found the key. cacheAsBitmap. Of course, cacheAsBitmap on one of the pieces didn’t work. Normal masking, for that matter, required cacheAsBitmap on both the mask and the maskee. The trick to make an inverse mask is to set cacheAsBitmap to true for the container of the things that are being masked.

I’m not sure what the performance implications of this are but the effect sure is nice. :-)

Example (click to invert, view source enabled):

The red horizontal lines are on the bottom level. The text and the green vertical lines are within containingCanvas on top of the red lines. The green lines are beneath the text and masked by the text by default. Click to have it mask the green lines in inverse.

Flex , ,

Travian Resource Reallocator

February 28th, 2008

Last but not least in this deluge of posts is a little utility I created to allow people to reallocate their resources efficiently in Travian. There is a feature in this game, for those who pay a little money, that allows you to change any type of resource (lumber, clay, iron, crop) into any other type. This is very useful for situations where you are producing way more of one resource than another or simply want to speed up your development but if you reallocate for one thing then want to use the remaining resources for another thing you would need to either calculate the amounts manually or reallocate multiple times (thus costing more “gold”). The resulting app allows you to reallocate your resources for any troop type in the game, allows for configuration of the # of them you wish to train, and lets you add any number of subsequent reallocations with the remaining resources.

Travian Tool

Flex, Games, Travian , ,

3D Sierpinski Gasket

February 28th, 2008

Let’s keep the ball rolling with another fractal creation. I’ve been playing with Papervision3D lately due to its use in a recent site I worked on and the San Francisco Papervision3D class I attended a few weekends ago. This latest is a verson of the sierpinski gasket which follows the same ideas as the last one I made but using 4 points to make a tetrahedron in 3 space. The same symmetry is applied but 4-fold and the lines are drawn but soon after removed as they quickly overshadow the pixels and slow the rendering down quite a bit once there are more than a few. Also notice that the pixels have some nice effects applied to them, making a kind fo vortex. Thanks to Andy Zupko for the Effects branch of Papervision3D and his part in the class I attended.

Sierpinski3D

Flex, Fractal, Papervision3D , , , ,

The Dragon (in Flex)

February 28th, 2008

Ever snce I got my tattoo(s) I have been explaining the fractal known as the dragon to anyone who takes an interest in it. I’ve even named some of my villages in Travian after the turns you take to create some of them. While explaining the fractal yet again I remembered the way that I originally learned to build it: draw the next iteration over the old one. I originally found this fractal at the beginning of each chapter in Jurassic Park. Since it had a regular box shape I used to use graphing paper to draw it, then after time realized that I could turn the paper over and draw the next iteration over the old one using a simple algorithm. Start by drawing a right angle to one side of the first line, then draw a righ angle to the other side of the next line, and repeat. I have programmed this fractal many times before but I had never actually coded up this algorithm before. I also wanted it to animate so as to show the drawing steps. Without further ado:

Dragon

Flex, Fractal , ,

Sierpinski Gasket (in Flex)

February 28th, 2008

While on the plane back from Indianappolis I had two new ideas for generation of a Sierpinski Gasket: 3-way symmetry and line display. For those that don’t know what a sierpinski gasket is, it is a fractal that starts as an equilateral triangle with another one inscribed inside it. The next iteration adds triangles inscribed in the 3 “edge” triangles. This continues over and over (forever).

This implementation uses a different method of generation. You start at a random corner of the triangle, choose a random corner, move halfway to it, and draw a dot. Continue to randomly choose a corner, move halfway to it, and draw a dot, and you get the same thing as above.

Sierpinski Gasket+

Flex, Fractal , ,

High quality Thermo video up on Adobe’s site

December 6th, 2007

Required watching for any Flex developer. Thermo looks like an awesome tool for those dealing with custom-designed UI elements. Check out the video.

Flex

String.split() bug should be fixed in Flash Player 9.1

December 4th, 2007

My bug was marked a duplicate of ASC-1739, which is slated to be fixed in Flash Player 9.1. I’m glad that others found this issue too.

Flex , ,