Reputation: 90
I'm looking for a way to draw draw/generate those shapes you can see on the image below in AS3/Haxe (OpenFL). Possibliy without any external images.
This is what I got so far: Version 2 (Source)
Upvotes: 1
Views: 187
Reputation: 91
It looks like these shapes are made up of rectangles with rounded edges of different lengths.
Here is how to get one:
var rect:Shape = new Shape();
rect.graphics.lineStyle(5, 0x00ff00, 1); //Last arg is the alpha
rect.graphics.beginFill(0xff0000, 1); //Last arg is the alpha
rect.graphics.drawRoundRect(0, 0, 100, 100, 25, 25)
rect.graphics.endFill();
addChild(rect);
You'll need to randomize the x, y. You can get a random number from n+-10 or so for x and n+5 or so for y.
Then do similarly for length and height.
Create about 5 of these rounded rects and see how you do.
If you try something like that and post the results we can work on the next step of connecting them.
Upvotes: 2