PDA

View Full Version : script for Clock like fill?


planetfour
08-02-2003, 04:43 PM
Hey all, brand new here, so I'm sort of like posting here by default. :D

Anyway, could anyone give me an idea of how to create a circular fill that would fill 25 degrees per frame? I'd like to mask something like that, but am very new to AS.

I know it must have to do with _rotation, but I've yet to script fills.

Thanks in advance to any help!!

Sualdam
08-02-2003, 07:17 PM
Not sure if this will help - it just creates a triangular segment, then duplicates it and rotates the duplicate to create what I think you meant.

It does it in 10 degree steps - I just did it quickly, but I'm sure you can modify it. Demo of swf here (http://www.snowdogdesign.co.uk/testloc/segdup.html)

(incidentally, you will have problems with 25 degree steps because 360 divided by 25 isn't a whole number. Can't you go for 20 degrees, or maybe 30?)

planetfour
08-04-2003, 01:13 PM
I thought about that afterwards, and chenged my mind to rotate 20 degrees at a time. So maybe my question should have been more specific to my intent.

What I'm trying to do is mask a mc on the main timeline in a circular motion by 20 degree 'wedges' per frame. I tried to find topics on this, like someone may have done a circular preloader, but couldn't find any.

Now, your code produces the effect I'm looking for as far as the shape and rotation, but would it be possible to achieve the mask effect with your shapes using setMask? I tried, but think I'm failing because you can only mask with one shape at a time? I'm not sure though, any help would be greatly appreciated!

Sualdam
08-04-2003, 09:23 PM
You've got me going now :)

Unless someone beats me to this (or you suss it) I can imagine that you could either create a class by which you could combine movie clips, or - easier - use math to calculate an increasing 'segment'.

In other words, that segment I drew and then duplicated - well, forget the duplication and use math to just repeatedly draw a shape consisting of the equivalent number of segments.

I like that second idea... will try it tomorrow ;)

planetfour
08-05-2003, 11:11 AM
i actually thought of that too, and tried to find out ways to express the focus points and anchor points in terms of the angle and radius, but it turned out incredibly wrong. I think I didn't take into account the range of sin and cos. (and of course, that implies I tried to curve rather than just create polygons like your example... i think you had the right idea:))

You may have a better time with it, as it was the first time I've ever tried to use any math in conjunction with AS. If you do figure anything out of course, I'd greatly appreciate it.

Sualdam
08-05-2003, 11:40 AM
Well, I'm at work at the moment and will get on it this evening.

I spent lunch working out how to do it (how sad is that?) - and it does involve sin and cos like you say.

Anyway, I know what I'm going to do so let's see.

Sualdam
08-05-2003, 03:55 PM
Take a look at this one - demo SWF here (http://www.snowdogdesign.co.uk/testloc/segdup1.html)

File attached.

The rainbow fill is a masked movie clip and the segments are the dynamically created mask.

I've got a headache now, by the way :)

planetfour
08-05-2003, 04:08 PM
I'll bet! You should see my notebook from trying to figure out Anchor points!

Anyway, I'm at work, so I know the swf is perfect, but I can't wait to see that code when I go home.

By the way, never got the chance to mention I love your avatar. It only figures that a fellow Simpsons fan (I know, who isn't) would be the one to rush to my aid.

Thanks a bunch, I'll let you know how it works out!

Sualdam
08-05-2003, 04:30 PM
Not wanting to labour the point, but this one is commented.

planetfour
08-06-2003, 01:28 PM
Well, I got it to work by modifying the code to fit my example, but yup, that's the idea! Thanks a bunch!

Now I just need to figure out how to stop the whole process. Didn't have a bunch of time last night... but thanks Sualdam!:D

cbear_rs
01-11-2005, 12:11 AM
:eek:

planetfour
01-11-2005, 02:53 PM
Well, Cbear, have to say I was quite surprised when I saw this thread resurrected in my email... I'll have to check out your script tonight.


Thanks!

cbear_rs
01-11-2005, 05:05 PM
Had not checked the date. Hahahaha better late than never.