Rough edges rectangle class

February 25th, 2010 by Slav

For a recent project I needed to create buttons with rough edges background. Gave it a quick google and couldn’t find a class for this, so I made a new one.

Demo

It uses drawPath command so requires flash plugin ver 10.

here’s the constructor :

/**
* @param w: width
* @param h: height
* @param col: background color
* @param distortion: amount of edges distortion (wawe-iness)
* @param density : density of distored vertexes
*/
new RoughEdgedRectangle(w, h, col, distortion, density);

so to create and add to stage you simply call something like :var sq:RoughEdgedRectangle = new RoughEdgedRectangle(500,250,0xFF00FF,3,100);
addChild(sq);
 

I made this little demo app that gives a visual preview of what the changing parameters does. It has view source enabled so you can download the source code.

Posted in flash

3 Responses

  1. ricardo

    top left corner is a little buggy, but nice job so far

  2. Alex

    Can you post the class?

  3. Slav

    Alex: Source code is visible in example app I posted. You can download it there..
    (http://durej.com/demos/roughedge/srcview/index.html)

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.