ActionScript 2.0 :: DrawingAPI An Ellipse?
May 17, 2005I want to draw a ellipse using a function that looks like this :
Code:
function crearecerc(mcClip:MovieClip)
{
[code].....
I want to draw a ellipse using a function that looks like this :
Code:
function crearecerc(mcClip:MovieClip)
{
[code].....
I want to draw a ellipse using a function that looks like this :
[Code]...
This function creates a circle but I want to create an ellipse knowing just the center , right distance and down distance like in this figure : figure mcClip is the movie clip. the center and the distances I take from a input text.
how to convert an exact point on a 2d grid to an isometric grid with the following function:
code:
function convertToIso(pointSent:Point) {
var returnPoint:Point=new Point((pointSent.x- pointSent.y),(pointSent.x+pointSent.y )/2);
[Code].....
I am working with this function that moves an object around a center point in a perfect circle and am trying to modify it to move it in an oval shape that is 1/2 as high as it is wide?
Basically, I have a set speed
var myVelocity:Number = 0.25;
Then I calculate my Sine and Cosine based on the speed
var myCos:Number = Math.cos(myVelocity);
var mySin:Number = Math.sin(myVelocity);
Then I figure the distance of the the object from a fixed center points along each axis and
var x1:Number = myBall.x - centerX;
var y1:Number = myBall.y - centerY;
var x2:Number = myCos * x1 - mySin * y1;
var y2:Number = myCos * y1 + mySin * x1;
myBall.x = centerX + x2;
myBall.y = centerY + y2;
I have another function that figures x and y based upon myBall.x = centerX + cos(angle) * radius; that is easy enough to modify the radius to become an ellipse, but is there an easy way to mod the one above to become an ellipse? I want to do this to be more efficient with the code and reduce the number of math function calls
I have 7 movieclips on stage I want to tween around an ellipse from different start points. I am having lots of trouble doing this. I used a circle formula at first and then divided the y value by the width of the ellipse over the height. This sort of worked but after every rotation the y value was a little of. That code is:
this._x += (Math.cos(angle * Math.PI/180) * radius);
this._y += (Math.sin(angle * Math.PI/180) *radius)/1.54;
I also have trouble finding the angle of the start point, if it is off they won't travel in the same ellipse but they all have different starting angles.
I have an Image object, and i wish to draw an elipse on it.
i have tried with
imageObj.graphics.beginFill( 0x0000FF, 0.5 );
imageObj.graphics.drawEllipse( position.x, position.y, 10, 10 );
imageObj.graphics.endFill();
but it doesnt draw anything at all.
how to draw graphic primitive on Image object ?
I'm in the final stages of my Papervision project and I need to have the camera orbit around its target in an ellipse rather than a circle on a mouse drag. The tricky part is I already am using some complicated logic to get it easing as well and I need them to work together.
ActionScript Code:
private function upHandler(event:Event):void {
isCameraRotating = false;
} private function downHandler(event:Event):void {
isCameraRotating = true;
previousMousePoint = new Point(mouseX, mouseY);
[Code] .....
have been messing around with ppv3d for a small project whereby a ball orbits some text. I would like the path of the orbit to be a visible line with a glow effect on it.at the moment I have a sphere located on an invisible spinning cylinder, with the text in the middle so the sphere orbits it. I've tried drawing lines from one point to another on the cylinder but it's not working.
View 2 Repliesgot another little provlem with flex ... i've made a ellipse and i want to rotate it dynamicly. made a h:slider which change the rotate="" value of the ellipse. and it rotates fine. but the rotation point is in the middle of the ellipse.
i want it at the bottom (y) and middle (x).
there are some transformY and transformX arguments for the ellipse, but they have no effect?
my function
private function rotateRadius():void {
if(wind.selected) {
selected.radiusDisp.rotation = radiusRotate.value;
[Code]....
Let's say I have the following MXML:
<s:Group id="b01">
<s:Ellipse x="267" y="96" width="30" height="28">
<s:stroke>[code]....
And that I have a dozen more of these groups with different ID's. How can I modify the fill color of each Ellipse using ActionScript? I know I can do something like this:
b01.getElementAt(0).width;
And that will give me the width of the Ellipse. But how can I access the SolidColorStroke color or the SolidColor fill?
In my application i am having one input field and the text fields edges are connected,that means with in one ellipse[movie clip] the input field will appear,if i increase the width and height of the field then ellipse should be increase as per the size of input field.
View 1 RepliesTrying to draw the top of a screw which is at a slight angle as its in perspective. I've tried doing this with the drawEllipse tool but its doesn't seem to be able to let me tell it I don't want it positioned straight, I want it rotated a little bit. I've tried doing it with curve To but it looks rubbish, but then I have only used 2 anchor points.
View 5 RepliesI want to make a dynamically (using Drawing API) drawn ellipse rotate around its axis. It involves a lot of trigonometry which I'm not very good in .
View 7 RepliesI want to make a dynamically (using Drawing API) drawn ellipse rotate around its axis. It involves a lot of trigonometry which I'm not very good in .
View 7 RepliesThe corners of a rectangle drawn with drawRoundRect are not very consistent when the curve/ellipse values are very low (2-5px or so), most visibly when there's a border added.Even with hinting turned on, there's still a pretty ugly difference. When set to 3px (horizontal and vertical), the right-side corners look pretty close at around 3px, but the left-side corners are very off, and both look to be maybe 1px curved.
View 1 RepliesThe AS3 getBounds function returns a rectangle that is not fitting tightly to a rotated ellipse. Instead it returns an axis-aligned rectangle based on the bounds of a rectangle whose width/height corresponds to the max/min diameter of the ellipse and follows its rotation.
Stack Overflow Q/A about the math of ellipses and bounding boxes
Based on this I took a stab at coding a solution in AS3. So far I have been able to produce a rectangle that fits perfectly along the x-axis, but as I rotate my ellipse it acts very weird along the y-axis. Rather than alternating between 2*r_min and 2*r_max while rotating, it alternates between 2*r_min and 0. My best guess is that I have done something wrong when solving the differentiated t for gradient -> infinity...
Here is an example from my code:
var r_max:uint = 45;
var r_min:uint = 20;
var rot:Number = ellipse.rotation * (Math.PI / 180);
var t_nil:Number = Math.atan( -r_min * Math.tan(rot) / r_max);
[Code].....
I'm trying to design a child's bracelet game, where they can drag and drop beads onto a string (circle) but I'm having trouble snapping the object onto my ellipse (circle), Currently the ball (bead) is stuck rotating around the ellipse, but I need it and multiples to be dragged from the bottom of the screen and then be able to snap to the ellipse once its closer, basically so that the child can choose a bead and drag it onto a string, to create their very own bracelet,
[Code]...