Flex 3 Truchet Tiling

March 4th, 2008

This example of Truchet tiling how to create easy Math patterns Flex 3. There are three classes TruchetTriangle, TruchetCircularArc and TruchetRandomArc.

The “Surprise Me!” button is quite fun to just watch the all the different patterns appear. So whats the purpose of this, well mostly to give my brain something totally different to focus on for a little bit while deadlines approach.

View it here! The source is available in the example, or you can get it here.

Entry Filed under: Adobe Flex

3 Comments Add your own

  • 1. Phillip Kerman  |  2008-03-04 at 2.03 pm

    Neat O! Nice job.

  • 2. Lars  |  2008-03-24 at 10.22 am

    Neat!
    What is the nature of the Random Arc setting? I thought at first it was just a random mixture of circular arcs and straight lines, then I thought it was hand-drawn lines, but it sort of looks like arcs at different size levels, fractal-like.

    Lars

  • 3. Renaun Erickson  |  2008-03-24 at 11.25 am

    The random arc one takes one of the two arcs and defines a random number of smaller arcs, then for each of the smaller arc it randomizes the value that defines the curve points.

    var parts:int = int(Math.random() * tileSize / Math.min(tileSize, 8)) + 1;
    for (var i:int = 1;i <= parts; i++)
    {
    var pointX:int = leftX + (tileSize/2*i/parts);
    var pointY:int = leftY + (tileSize/2*i/parts*upDown);
    var arcX:int = int(Math.random() * (Math.max(lastX, pointX) - Math.min(lastX, pointX))) + Math.min(lastX, pointX);
    var arcY:int = int(Math.random() * (Math.max(lastY, pointY) - Math.min(lastY, pointY))) + Math.min(lastY, pointY);
    graphics.curveTo(arcX, arcY, pointX, pointY);
    lastX = pointX;
    lastY = pointY;
    }

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Disclaimer: I work as a Flash/Flex Developer for Adobe Systems Incorporated. The opinions expressed here represent my own and not those of my employer.

My Amazon.com Wish List

Calendar

March 2008
S M T W T F S
« Feb   May »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Most Recent Posts


Flex.org - The Directory for Flex