Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 07-27-2011, 01:39 PM   #1
Larsen Pedersen
Registered User
 
Join Date: Jul 2011
Posts: 1
Question Make small circles/dots form a complex shape

Hej guys,

I've bee following this site for a long time, and now I finally got a question on my own.

I'm trying (by ActionScript) to make a bunch of small circles form a complex shape e.g. a star or a windmill.

I'm planning to draw on circle and draw it to bitmap date, but I don't know how to place a lot of circles in the shape of a complex shape (or how to transform them into another complex shape).

Have you got any ideas for this? - or maybe someone else has been doing something like it?
Larsen Pedersen is offline   Reply With Quote
Old 07-27-2011, 01:46 PM   #2
santanoa
Dual Screen Empowered
 
santanoa's Avatar
 
Join Date: Jul 2010
Location: Israel
Posts: 258
Default

I am actually doing something kind of similar, if I understand you. I think you want a way to draw shapes, made up of smaller circles. What I'm doing is a collision detection system that samples a certain size square (let's say 10x10 pixels) in a bitmap for a certain color. If a majority of this square is that color, I'll place a marker on a 2d array. I repeat this for the entire bitmap and end up with a sort of really pixelated version of the image. If you drew a rough copy of the shape you wanted, imported it into flash and then had the as3 loop through it using this method, you should get what you're looking for. Then all you have to do is place a circle at each marker.

Note: my method is not at all optimized for speed. The calculations I'm doing aren't actually done in the finished project, just beforehand to get the array and paste it where it needs to go.

Last edited by santanoa; 07-27-2011 at 02:04 PM.
santanoa is offline   Reply With Quote
Old 07-27-2011, 01:54 PM   #3
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

Howdy and Welcome...

I haven't done that before, but I'd probably approach it this way if I were to do it...

The biggest assumption that I am making is that the shape you want to draw is something that's easy to generate by ActionScript...
For example, if I were to fill the shape of this balloon with dots, I should know how to cut the background out and leaving just the desired area... This probably can be achieved by doing some bitmap manipulation...
http://www.fantasyfliers.com/balloon001.jpg

But as a simple example, let's just say that I know how to do that...

#1. Load that image into the Flash...
#2. Load that image into the Flash one more time and place it above the previous image from #1...
#3. Create a mask image out of the desired area out of the image from #2...
#4. Create a new sprite and lay it down below that mask...
#5. Measure the rectangle dimension of the mask and draw dots in a grid which all happens inside the sprite created in #4...
#6. Set the mask of the sprite with the mask created in #3...

There you should have balloon area filled with dots...
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 07-27-2011, 03:33 PM   #4
henke37
Senior Member
 
henke37's Avatar
 
Join Date: Mar 2009
Location: Sweden
Posts: 10,675
Send a message via Skype™ to henke37
Default

There is a full science about using dots to represent images. Call your local printing company and ask them to explain things.
__________________
Signature: I wrote a pair of articles about the timeline.
henke37 is online now   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:16 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.