ActionScript 2.0 :: Trigonometry - Line To Continue After The Points In Both Directions And With The Same Steep
Sep 27, 2005
Is there someone who is good at trigonometry? I have two points punkt1 and punkt2 and a line that is drawn between them. Both points is dragable. I want the line to continue after the points in both directions and with the same steep. I have counted the steep between point1 and point2 and tried to continue to drag to a point with the same steep, but it doesnt succed.
[Code]....
View 3 Replies
Similar Posts:
Oct 3, 2011
I have been tasked with trying to create a drawing tool that draws dotted lines as you drag the mouse across the stage. I can easily capture the points on MouseEvent.MOUSE_MOVE and store them in a vector and then draw the points as dots:
The problem is that I need to calculate evenly distributed points on an ever growing Vector of points so I can only draw the line between say every 5th point (say using modulus). I have been battling away with Bezier curve equations both Quadratic and Cubic but still can't quite figure out how to convert my Vector of points into an evenly distributed Vector of Points without sucking the life from the CPU.
View 1 Replies
Jul 3, 2009
I'm in the process of teaching myself the components of the CS4 Design Premium package using the Adobe Classroom in a Book series. I'm currently going through the Flash CIAB and i've started using the pen tool. The task involves creating a wave like design across the stage. Whilst this in itself is simple, the final instruction is to click on the first anchor point to close the shape. In the illustration, the closed shape seems to automatically extend around the stage, however when I click on the first anchor point, the line automatically connects between the two points in a straight line.
Am I doing something wrong? The next step is to fill this area, but with the straight line effect that I am getting, this becomes impossible. I should point out that the instruction states that the pen tool line should extend off the stage. I have done this, but even then on clicking on the first anchor point the shape is closed incorrectly.
View 2 Replies
May 20, 2009
I want to create line between 2 points ...such tht the line will start when i click the point A then i will drag the line by holding it to point B and i will join the line to point B by clickin on point B (somethin like the pen tool) ..then line will then be joined between the points ...
View 1 Replies
Oct 15, 2011
I have a component (link to Test class) which contain one line in it, and I put one point of this line to (0, 0).
Then drag it to Flash(fla), and get its Shape in AS3 like:
// in Test.as
// assume that the movie clip only contain one line.
var line:Shape = Shape(getChildAt(0));
And I can get one point of this line which is x and y of var line. But how to get another point of this line?
Edit:
Ignore component stuff above, here has another question but I guess it pretty much the same as the question above:
Draw a line from (0, 0) to (10, 10) and draw another line from (10, 0) to (0, 10), how to get those lines of two-point form in AS3?
If I access them as Shape then I get two similar shapes which have same x, y, width and height values. Does AS3 has some way to access line as a REAL line not just a shape? or does it has any way I can calculate it out?
View 2 Replies
Aug 25, 2010
I want to ask how do you join two points with a line using actionscript? The points would be constantly moving.
View 9 Replies
Oct 28, 2010
I have a line that is drawn using the draw api. I need to find points on the line when given the x value, how would I do this. I know on the bezier segment I can just user the yForX() and get the value but not sure how to with just a straight line.
View 5 Replies
Oct 23, 2009
I need to create a line drawn between 2 points. My actual idea is of joining 3 points with lines drawn dynamically(for a triangle).
View 1 Replies
Aug 20, 2009
I'm using Flash 8 and AS2 I am attempting to make some code that checks whether or not a line that rotates around the screen is hitting a movie clip. Here is my code (with comments explaining it):
[Code]....
View 3 Replies
Feb 14, 2010
Closed path made with pen tool in Flash MX comprises of line segments & curved segments both.While adding anchor points on segments it is noticed that pen tool adds anchor points on curvaceous segments but not on line segments. Why is it so ? Is their any way to accomlish this task ?
View 5 Replies
Feb 3, 2005
find a points in a line Actually i want to make some footsteps in a sand. The footsteps are dhynamically placed on the stage. How to find the points in a dioganal. see the image
View 1 Replies
Feb 3, 2005
i'm trouble to find a points in a line Actually i want to make some footsteps in a sand. The footsteps are dhynamically placed on the stage. How to find the points in a dioganal.
View 1 Replies
Oct 19, 2008
draw a squiggly or wavy line in the MOUSE_MOVED event as the user clicks and moves the mouse.
View 1 Replies
May 10, 2011
I am trying to draw a continuous curved line in flash. There are many methods but none of the ones I have found so far quite fit my requirements. First of all, I want to use the flash graphic api's curveTo() method. I DO NOT want to simulate a curve with hundreds of calls to lineTo() per curved line segment. It is my experience and understanding that line segments are processor heavy. Flash's quadratic bezier curve should take less CPU power. [code]...
View 3 Replies
Nov 1, 2010
this is the thing: Using "lineTo" i get a line drawn on stage when dragging a mc. Then i should have four mc (note1, note2, note3, note4) added randomly over this line. I mean, the line is drawn and then over some parts of this line, using x and y of some of the points drawn there, this movie clips should be added randomly. I can make the mc appear randomly, but always in the same point (mouseX, mouseY); i cannot access others x and y of the drawn line. This is my code (noteContainer is a sprite):
Code:
private function drawingAPI(event:MouseEvent):void{
sprite1.graphics.lineTo(mouseX, mouseY);
}
[Code]...
View 9 Replies
Jan 11, 2012
I think it would be cool if the line started out as flat (i.e., y=_height/2 for all points) and then the y points of the line animate into place.I don't even know where to start with doing this in TweenMax/Lite... I've seen several code snippets that draw a line from left to right, but that's not what I want.
View 6 Replies
Mar 31, 2011
I am trying to implement contour lines in ActionScript using Conrec. I have looked at both the java and javascript implementation and am still stuck.URL...Conrec will take grid data and assemble continuous contour lines. The problem is that it does not necessarily draw those lines in a continuous fashion. For example, it will draw A->B and then C->B and then C->D instead of A, B, C, D, etc.The javascript implementation seems to be accounting for this and serializing the instructions into an array of draw points. Which is what I too want to accomplish in the end. That is it takes the instructions from the core Conrec logic (eg: A->B, C->B, C->D, etc) and organizes it into an A, B, C, D series. I think it will also return the series as a multi-dimensional array to accommodate broken lines (eg: [[A, B, C, D], [E, F, G]]). This last functionality is what I need to do in Actionscript.This last part is where I am stuck. Ignore Conrec for now (I have given up on finding an Actionscript implementation), how can I organize these instructions into a collection of serial points? When Conrec gives me "draw point from X->Y" how can I first check if X or Y are already in a series and append either X or Y (whichever is not in the series) into the series? AND if neither are in the series, start a NEW series with X, Y as the starting set. Then check subsequent instructions against all existing series and connect series if they now start and stop on the same point? Also, I need to be able to allow for a series to close itself (eg: A, B, C, A) -- a loop (is that even possible?!).
I'm not sure if there is a technical term for what I want to do beyond "concatenation". I also hope someone out there has done this with Conrec and can give me some pointers.In the meantime, I am going to continue to plug away at this and see if I can come up with something but I am not confident in my abilities.If you know another way to draw contour lines from grid data, I am open to alternatives. But I have to be able to implement it in Actionscript.
View 3 Replies
Apr 15, 2011
I have a large-ish array of points.
The graphics object I am using has it's alpha value set to 0.1.
When these points are plotted iteratively, and the line being drawn overlaps another line drawn earlier, there is no visible change in the colour at the intersection.
If I draw the line differently, not using an array of points, the alpha is not ignored.
ActionScript Code:
public function render(e:Event):void
{
if (segmentsCollection.length > 0)
[Code].....
This all occurs on each ENTER_FRAME event until the array is emptied.
I have tried loads of options but the alpha is always ignored.
View 5 Replies
Apr 16, 2011
I have this game where a movieclip moves towards the mouse point by finding the difference and dividing by its "speed". This isn't very good though because different users will have different cursor speeds. What I really need is a method that finds the angle between the two points then uses that angle and a "speed" to calculate the next position of the moving movieclip.Here's something along the lines of what I am looking for but it doesn't quite work?The function runs and everything. All that works, it's just the maths that isn't right.Something needs changing with the maths.
ActionScript Code:
function moveCircle(e:Event):void
{
[code]......
View 4 Replies
Apr 22, 2004
I need some help with trigonometry in flash mx. I was inspired by this site and was wondering how you do it...go to 'images'..I dont want to just copy and paste a script you would give me..
View 1 Replies
Oct 28, 2011
From what I have gathered, _rotation uses radians?Basically, my initial goal was to make a movieclip rotate towards the mouse. I'm not very good at trigonometry.Using the help files I found atan2 which seemed to be what I needed. A little fiddling got me to this code:
var xDist:Number;
var yDist:Number;
var angle:Number;
onMouseMove = function () {
[code].....
However,the _rotation is opposite what is expected. This is not a problem as I can just flip the movieclip. But really what im here to ask is, please ecplain this code for me? I don't correctly understand how atan2 works.. and why it needs to be *60.Basically: How to get a movieclip to rotate towards the mouse.. and why does the code work, I want to learn trigonometry.
View 3 Replies
Dec 20, 2005
i know how to check the angle between my object and the mouse, but i dont know how to make it rotate slowly to it...
i tried this codes:
Code:
//first method:
onClipEvent (enterFrame) {
this._rotation = (Math.atan2(_root._ymouse-this._y, _root._xmouse-
[Code]....
View 9 Replies
Dec 1, 2009
I have 2 points you can drag. A draw a line between them. I have a textbox that displays the distance between the 2 points. How can I have the textbox "attach" itself to the midpoint of the line and stay there as the points are dragged?a file is attached and you can see it here [URL]
PHP Code:
var item:MovieClip;
var dragOffsetX:int;
var dragOffsetY:int;
var itemOffsetXY:int;
[code]....
View 3 Replies
Oct 19, 2005
I'm working on this sliding bar navigation thing , and I'd like to make the bar "snap to" certain points along the line.
View 5 Replies
May 7, 2003
Basically I have two movie clips. I know the x diff and the y diff, now how do I find the angle at which the movie clips are at?
Code:
v MC 2
/|
/ |
/ | < y diff
/ |
MC 1 > /__|
^
angle x diff
View 10 Replies
Jan 28, 2012
I have a movieclip that moves arround on my stage. I'm looking for a way to tell what direction my movieclip is going in AS3. (up, down, left, right
View 1 Replies
Sep 16, 2010
I have been googling my butt off I can not find anything about AS3 and shooting in different directions.
I just need to shoot in the direction my char is facing.
I have this so far which work flawlessly ;-)
function Shoot(event:MouseEvent):void { trace("shoot");}
oh also I can get the direction my hero is facing using trace "character_mc.rotation"
View 3 Replies
May 29, 2011
I've got two concentric circles with their centers at (centerX,centerY). The inner circle has a radius of 100 and the outer circle has a radius of 400. If take a point on the circumference of the inner circle, I can draw a line from the center to that point. Let's call that point x1,y1). I now want to continue that radius out to the outer concentric circle and calculate the position of that outer point (x2,y2).
I'm adding a 3px 'dot' just to show where x1, y1 is on the screen. (Subquestion: I can't see it...not sure why.)This is what I'm trying:
var x1:Number = 100;
var y1:Number = 50;
var x2:Number;[code].............
View 1 Replies
Jun 4, 2009
I'm trying to clone The Legend of Zelda (NES) Link's movement.
This what I have:
PHP Code:
stop();var leftKeyDown:Boolean = false;var upKeyDown:Boolean = false;var rightKeyDown:Boolean = false;var downKeyDown: Boolean = false;var linkSpeed:Number= 7;// Link MovementLink.addEventListener(Event.ENTER_FRAME, moveLink);function
[Code].....
View 13 Replies
Dec 31, 2011
Ok, so I got this huge image of a map. I put a Mask over it so it will fit on a small screen. But....I want users to be able to view the whole map but click on arrow buttons that will transfer them in all 4 directions. I know I can do this with keyframes, showing different parts of them map each stage....But isn't there a simplier way? Some sort of actionscript code that will tell flash to scroll how many pixels left or right or up or down? And that it will know that the image will stop here so don't scroll more than that?
View 4 Replies