-
Ok I have a circle.
Origin 0,0.
The Radius is dynamic, we'll call it X length.
We need to find a dynamic number of points on this circle. All equidistant from each other. We'll call this number Y.
Is there a formula to find the choordinates of each of the dynamic points?
-
make 2 MC, the moving point and the circular centre (instance: a)
put the following code to the moving point for circular motion.
Code:
onClipEvent(enterFrame) {
this._x=a._x+Math.cos(speed)*radius;
this._y=a._x+Math.sin(speed)*radius;
speed+=0.1;
radius=100;
}
:o) Cheers
Mkit
-
Not what I was looking for, but works perfectly, thanks.
-
Oh actually you can use those 2 equations to calculate the number of points, maybe store in the array.
Code:
storex = new Array();
storey = new Array();
radius=100;
for (i=0;i<10;i++) {
speed = random(360);
storex[i]=a._x+Math.cos(speed)*radius;
storey[i]=a._x+Math.sin(speed)*radius;
trace(storex[i]+","+storey[i]);
}
you can add more REGULATIONs to either ground the value/ trancate the value / round the value.
Cheers
MKit
-
watch those [i]'s MKit ;)
Heres a way to get points based on a distance value representing the distance in px you want those points to be away from each other (along the arc of the circle that is, not relatively in coordinate space)
Code:
twoPI = Math.PI*2 // just variable for 2 pi
distance = 25 // distance between points on circle
circ = twoPI*radius // radius is your dynamic "X length"
numOfPoints = circ/distance
angleMod = twoPI/numOfPoints
points = [] // points stored in this array:
for (angle = 0; angle <= twoPI-angleMod; angle += angleMod){
points[points.length] = [Math.cos(angle)*radius,Math.sin(angle)*radius]
}
points[index][0] = x value, and points[index][1] = y value
[Edited by senocular on 07-10-2002 at 05:00 AM]
-
Oh thanks senocular
Quote:
Originally posted by MKit
Oh actually you can use those 2 equations to calculate the number of points, maybe store in the array.
Code:
storex = new Array();
storey = new Array();
radius=100;
for (w=0;w<10;w++) {
speed = random(360);
storex[w]=a._x+Math.cos(speed)*radius;
storey[w]=a._x+Math.sin(speed)*radius;
trace(storex[w]+","+storey[w]);
}
you can add more REGULATIONs to either ground the value/ trancate the value / round the value.
Cheers
MKit
-
http://www.geocities.com/imaretard_2002/tobesent.swf
Watch out, I haven't compressed the images yet, though.
Didn't expect that did you?
How? Simple I stopped ._y movement, and made that value a temp variable called "Objdepth".. And accordingly change width height and alpha.
Neat?
-
hey steve, few months ago, I made the same thing too:
http://member.hkbn.net/~f-mkit/kit/navigation.swf
hehe~
MKit
-
yours wouldn't fully load for some reason, odd.
-
I couldnt get either.. then again Im out in the boonies running about a 14.4 :-\
I'll just sit here and pretend like I saw them and that I was impressed :)