Animated drawing of curve

Hey
I have searched the internet, but have not found any solutions.
How can I animate a curve being drawn with as3 drawing api.
I am not interested in masking it out or other tricks. I am interested in drawing it whith the api.
This would be the equivalent, but only a straight line:
var steps:Number = 30;
var currentStep:Number = 0;
var startPoint:Point = new Point(100,100);
var endPoint:Point = new Point(300,300);
var g:Graphics = graphics;
g.lineStyle(1);
g.moveTo(startPoint.x,startPoint.y);
addEventListener(Event.ENTER_FRAME, thisEnterFrame);
function thisEnterFrame(e:Event):void
currentStep++;
g.lineTo(startPoint.x+(endPoint.x-startPoint.x)/steps*currentStep, startPoint.y+(endPoint.y-startPoint.y)/steps*currentStep);//startPoint.y+(endPoint.y-star tPoint.y)*currentStep);
if(currentStep==steps) removeEventListener(Event.ENTER_FRAME, thisEnterFrame);
Does anybody have the math skills to do this with a curve?
Jakob

One way that I've used on a few occasions is to use TweenLite/Max's bezier curve generation. You can use as many points as you like and it will create a smooth curve through them - then you use the onUpdate function to do your drawing. Works great.
It would work like so:
import com.greensock.TweenMax;
var a:Sprite = new Sprite();
a.x = 100;
a.y = 100;
graphics.lineStyle(1, 0x000000);
graphics.moveTo(a.x, a.y);
TweenMax.to(a, 5, {bezier:[{x:310, y:130}, {x:131, y:276}, {x:300, y:345}], onUpdate:drawLine});
function drawLine(){
     graphics.lineTo(a.x, a.y);

Similar Messages

  • Drawing a curved line using the pen tool, dragging the text cursor over the line but will only give me a small area to write in, in-between a circle and a circle with a cross in?

    Drawing a curved line using the pen tool, dragging the text cursor over the line but will only give me a small area to write in, in-between a circle and a circle with a cross in?

    If you change your tool to the "Direct Selection Tool" (A) then you should be able to adjust the area for you to type in...

  • Drawing Custom Curves, Shapes, S Shapes, etc.?

    How do I draw symmetric curves, custom shapes, S shapes, etc?
    I am a beginner, and I have PSE 6.  I can upgrade to version 8 or use plugins if necessary.  I’ve been googling this, but is the pencil the same as the pen?  Where are the Paths options?
    -->  My question is I am wanting to create custom shapes.  For example, a half circle curve, or an S shape.  How do I do that? I’d rather not use the Marquee tool. 
    Attached is an example of a curve that I want to reproduce.
              Thanks for any help.

    multiplexed2 wrote:
    How do I draw symmetric curves, custom shapes, S shapes, etc?
    I am a beginner, and I have PSE 6.  I can upgrade to version 8 or use plugins if necessary.  I’ve been googling this, but is the pencil the same as the pen?  Where are the Paths options?
    -->  My question is I am wanting to create custom shapes.  For example, a half circle curve, or an S shape.  How do I do that? I’d rather not use the Marquee tool. 
    Attached is an example of a curve that I want to reproduce.
              Thanks for any help.
    No, the pen tool is only in Photoshop. The best you can do in Elements is download shapes that have been made in Photoshop or draw out a shape and either add or subtract from the shape. You don't have a paths palette either although they exist just not accessible as in Photoshop.  You'd have to save the shape file for reuse as you can't define custom shapes in Elements.
    Type  custom shapes Photoshop and you will probably find the shape you need in one of the many freeware sets out there. They'll say for Photoshop but you can install and use them in Elements.
    For the shape of the .bmp file you posted, you can cut a rectangle shape with a circle.
    1. Draw out a rectangle with the rectangle shape tool.
    2. Press the subtract icon in the options bar.
    3. Draw out a circle to remove the unwanted area.
    4. Save the file as a PSD with a name you can remember so you can use it whenever needed.
    Note: The shape will be still be vector provided you saved as a PSD so it can be resized without degrading it.
    If you hover over the icons, tool tips will display telling what each one does. Here's an image of the icons you're looking for in the options bar in step #2.
    Example of shape cutting...path lines are present because I haven't clicked away from the layer before taking the screen shot but useful as it shows how I cut the shape. To get the curve centered, it would be helpful to add some grids. I didn't use them in the image below and you can see I'm a little off center.

  • Freehand drawing with curve support

    Hi there,
    I have here a more complicated question. Maybe you can follow me.
    Is there a way within PS to support freehand drawings. What I mean is a support in that way which makes hand drawed curves more smooth. You know what I mean. I think Marcomedias Flash does such things. Is this also in PS availible?

    Not that I know of. Since PS does not draw Bezier curves, there is no way to smooth them. Any curvature in PS is merely a result of the stepping and accumulation while drawing the strokes. Maybe it does some smoothing on the fly under the hood, but not in the way you can in other Adobe apps.
    Mylenium

  • Drawing a curved line

    Okay, so I feel like this is a really stupid question, but how in the world can you make a line curved? I've inserted a line as a shape and want to make it curved (similar to the curve in the Apple Demo with the moving airplane -- I'm trying to do something like that). I know how to make the objects move, but I want the path to show. An earlier post said to draw the path first and then create the path to match that. That's fine and doable, but I can't for the life of me figure out how to draw a curved line!

    You use the Pen tool, found at the bottom of the Shapes dropdown menu, to draw a curve. Select the pen, then click on the slide to put down the starting point of your curve. Next, click and hold where you want your curve to end, and drag away from the endpoint that is created. You should see two grey "handles" sprout from that endpoint, with your cursor at the end of one of them. The point you have created is a Bezier control point, and the handles control the angle and depth of the curve. Hit Escape to finish. (Your curve will likely be filled -- you can adjust this in the Graphic Inspector.)
    One Bezier point will produce a curve that only curves one direction. To create a more complex curve with multiple inflections, you will need to add more points. Select your curve, and in the Format menu, under the Shape flyout menu, choose "Make Editable". You should now see your two endpoints in red. If you hold down the Option key and click on the path, you will add another control point. Double-clicking on the point will toggle it from a corner point to a Bezier control point.
    Bezier curves can seem complicated at first, but this is an extremely powerful way of creating arbitrary shapes, including complex curves.
    (Note that the paths in the Motion Action are also Bezier curves.)

  • How do I draw a curved line in iCloud Keynote beta?

    I am fairly new to Keynote in general, however I would like to leverage it's capabilities to enhance my projects at work (where I have a Windows7 PC w/o admin rights to install software).  I know you can draw curved lines with the Keynote on a Mac, but I can't seem to figure it out with iCloud Keynote beta.  Any advice would be greatly appreciated.  Thanks,

    Try this:
    File>New>blank file
    Duplicate the background layer, and work on the background copy layer
    Get the Elliptical marquee tool out of the toolbxox. Drag out an ellipse
    Go to Edit menu>Stroke (outline) selection, try width=4x, position:inside
    Use the eraser tool to erase part of the ellipse
    Use the transform tool (CTRL+T) to rotate and skew the remaining curve to suit
    It's a bit tedious, but it can be done.

  • How to draw smooth curve in Hyperdraw??

    Okay, I've checked the manual 4x and have been playing with Hyperdraw for 30 minutes and still can't figure out how to draw a smooth bell curve in the Hypereditor... In Cubase, I would take the pencil tool and draw a nice curve but can't seem to figure out how do the same in Logic!
    Could someone pleeeeease lend me a clue...?
    Thanks.

    RealDave wrote:
    "The name on the package may say "Apple," but this is definitely not your typical mac application!"
    Yes, Logic was an acquisition. It has remained to this day "The Redheaded Stepchild". If they ever take
    some engineers off the iOS projects and put them on Logic, the application may shape up. Don't get your hopes too high though. iOS is where they make all the Money. Logic is small potatoes in Apples big picture.
    PS: This message will soon disappear because it contains truth.
    To give them credit, Logic made a HUGE jump in usability when it hit Logic 8.
    I mean, MASSIVE.
    It's actually usable by mortals now.
    Even among professional tools, there are well-designed ones and completely arcane ones with the same functionality.
    Logic grew over decades of adding an extra little limb here, and growing a third chin down there, etc., at the behest of a hundred studio techs missing this or that and calling up the engineers or higher-uppers. It was an extremely powerful, but utterly convoluted MESS.
    The fact that you can now explain the basic structure of Logic 8 in less than three minutes (the fact that it HAS a "basic structure", rather than just a kraken-like reenactment of 80 years of studio development known as "The Environment") makes a huge difference, and, though they've confused people who've whittled the beast into shape over the past twenty years by trying to make the application "Logical" (including key commands), the benefits to users are, IMHO, tremendous.
    I know a number of people who wouldn't have considered working with Logic before (Nuendo users), and now that Logic 9 appears to have fixed many of the most glaring bugs in Logic 8, are adding it to their toolset.

  • Animated themes bb curve 9300

    hello im a new bb user and i need  your help , i have tried downloading animated themes from app world and they wont work , they are compatible with my phone, they dont even show up where the themes are listed , i found the ones i downloaded in my files folder and when i click on them it says unable to open file , ive tried pulling the battery after downloading and everything , its really doing my head in now aarrrgggghhhhh lol , please help me xx

    try updating ur phone it helped. 

  • Animating "Drawing" in Flash

    I'm sure this is a frequent question, but I haven't found the right search terms to yield results.
    I'm attempting to animate the drawing of a line... A line with about 10 segments, which I basically want to be drawn in from the top to the bottom of the stage.  It seems that this can be done with masks, but I'm curious if there's a way to have it actually be drawn in... (hopefully without the use of AS).
    Thanks in advance!

    Without the use of AS your only option would be to use a timeline tween where you either move a mask over the line or gradually change one dimension. The mask approach would be the most likely to resemble what you probably want.

  • Draw a curve

    Hi
    spent all after noon trying to replicate a jpeg logo for a website
    http://www.edwards-micros.co.uk/curve.html  is the jpeg
    Ive tried using rectangles to replicate and joining the paths and using the pen tool but all efforts are terrible,
    It's the blue area I need to copy.
    Am I just lacking in skill  with the pen tool or using the wrong approach?
    any pointer appreciated
    thanks
    Ian

    The whole thing can be done with a single stroke.
    Hold down Shift as you drag out the anchors to keep them straight.
    Once you've got the backmost one right you can add the others with the Appearance panel's flyout menu, Add New Stroke. Adjust the colour and weight of the new stroke(s) as you please.

  • Quartz drawing curve - Weirdness

    I've got a weird issue with quartz. The first time I use this piece of code, the line will be drawn like the line to the right in the image. The second time (and every time after) these lines are executed, the line will look like the line to the left. Why does it look like that? It's all jaggy and dark. If you'd draw the curve with opacity, it would be rather bright the first time, and very dark the second.
    CGContextSetRGBFillColor(context, 0.0,0.0,0.0,0.0);
    CGContextClearRect(context, CGRectMake( 0, 0, 320, 480));
    CGContextSetRGBFillColor(context, 0, 0, 0, 0);
    CGContextSetBlendMode(context, kCGBlendModeNormal);
    CGContextSetRGBStrokeColor(context, 1.0, 1.0, 1.0, 1.0);
    CGContextSetLineWidth(context, 4.0);
    CGContextMoveToPoint(context, p1.x, p1.y);
    CGContextAddCurveToPoint(context, cp1.x, cp1.y, cp2.x, cp2.y, p2.x, p2.y);
    CGContextDrawPath(context, kCGPathStroke);
    !http://pici.se/pictures/NPTbVloLR.png!
    Message was edited by: rawgrarr

    Being a total newb, I cannot help noticing you set the fill color to black in your first line.
    Would that not imply Quartz tries to antialias the white line to black?
    (Although that does not explain why it's correct the first way around.)

  • Help drawing curved line - please!!!

    Seriously, I can't find a tool to draw a curved line in PSE 6!  I was told to use the "pen tool" but I can't find it.  I was told to make the selection right clicming on Pencil and has no options other than for a freehand drawing with the mouse.  The "shapes" tool will only give me a straight line.  What the heck am I missing?
    Thanks!

    The pen tool is only in Photoshop, not elements. You can draw freehand with the brush or pencil tools (you can  put something on a separate layer below and trace the edge if you need help), or you can draw a selection with the elliptical marquee tool, go to Edit>Stroke (outline) selection to color it, then erase the parts you don't want.
    The custom shape tool draws many shapes. It sounds like you have the line tool selected. Hold down its icon in the toolbox and you'll see several other tools in there. The polygon tool with the rounded corners option turned on will draw circles, although it's not supposed to.

  • Drawing curved lines in Photoshop CS 4

    I'm sure there's a simple way, but I just can't seem to draw a basic curved line in PS CS4.
    I'm designing a simple floor plan- black lines on white background- nothing 3D or fancy. I have so far just used straight black lines, but for the doors I wanted
    to create a curve to show the sweep of the door as it opens.
    I'm new to photoshop, so at first I tried to do so in a shape layer, as I did with all the straight lines. annoyingly, this always resulted in a filled in solid shape- not what I want at all.
    I then found out about paths, so I created my curve as a path, which seemed to be working in that it didn't automatically turn into a solid shape, but remained simply a line.
    However, I found that the path was not actually showing up in my floor plan unless I had it selected and was working on it. I worked out I could link it to a layer by creating a vector mask.
    However, this still meant the curve didn't display within the document when I saved out. If I rasterized the vector mask, it just made everything go black.
    Please can someone explain if there's a simple way of drawing a curved line?

    Hi,
    Thanks for your response.
    I'm a little confused-
    "Paths are not pixels, so unless you
    • use a Path as Vector Masks on Layer/Group that has content
    • apply "stroke Path with …"
    • use the Path as a Clipping Path"
    Does this mean that if I make the path with my curved line on it into a vector mask, apply a stroke path and then use the path as a clipping path, it will show up in my document? I tried doing this and it didn't work- when I saved out a jpeg it was blank. 
    If it makes it any clearer, this is what I'm trying to get to be part of my pixel output:
    I did actually try your suggestion of playing around with Layer Style, and this sort of seems to work in a weird way, but it seems incredibly strange that Photoshop doesn't provide a simpler way of doing something as basic as drawing a line!
    thanks for your help, really appreciated.

  • Drawing order of curve behind loaded movie

    Hi,
    I'm having an issue with the draw order of curve that's drawn
    using Actionscript. In terms of the order of execution of the
    function call, I have a SWF loaded first using the loadMovie
    function. Then I call the curveTo function with certain parameters
    to try to draw a curve on top of the loaded movie. However, the
    strange behavior is that the line is hidden behind the movie clip.
    I've used swapDepths, but it wasn't working for me. Also tried
    using the createEmptyMovieClip function with a depth number
    assigned, but didn't do the trick. Any suggestion?

    1.  there's no reason for an onEnterFrame loop.
    2. there's no reason to use any setInterval() functions in the code you showed.
    3. you should be using the same function to load your swfs.  if some logic is needed to position, for example, the different swfs in different locations, the logic should be in that function.
    ie, you should be using something like:
    _level0 swf:
    function nextMov(){
    loadF(MovieList[movieQNum]);
    movieQNum=(movieQNum+1)%MovieList.length;
    function loadF(swf:String){
    dep = getNextHighestDepth();
    currLo.removeMovieClip();
    currLo = createEmptyMovieClip("currLo"+dep, dep);
    loadMovie(moviename, currLo);
    //move the loaded movie behind movie frame
    BlackMovieFrame.swapDepths(currLo);
    function endSession(mc:MovieClip){
    mc.removeMovieClip();
    nextMove();
    // in the loaded swfs:
    var tl:MovieClip=this;
    btnArrow.onPress = function() {
    _root.endSession(tl);

  • Velocity Input Curve Drawing Bug

    Hi,
    I'm trying to scale the midi velocity input of my controller by drawing a curve. However, when I draw the curve in the "velocity input" window, my trackpad pointer is offset. That is, it doesn't select where I click. Highly annoying bug. Any ideas?
    Thanks

    Hi
    Checked on 2 systems:
    MacPro 8 core OSX.10.8.3
    MacBookPro (2012) non-retina  OSX 10.8.3
    CCT

Maybe you are looking for

  • Purchase orders manily against the sales orders

    My client do purchase orders manily against the sales orders... but to meet the minimumn purchase order quantity or value they club many sales orders in a single purchase order... now is there any way to track for what sales-order-item what purchase-

  • Cannot Resolve Symbol on New Keyword

    I done something stupid, but what? I've defined a new class, in a new file that shares a package but cant instantiate it because the 'new' keyword apparently cant be resolved. In the Main file I have ( last line shows the problem ).. package myprojec

  • Weblogic error in OEM GC 11g

    Hi, We have installed OEM Grid Control 11.1 on a Linux Suse 10 machine (which will act as a middleware/gateway machine to the database hosted on the remote machine.) We have completed the Grid installation successfully also we are able to connect the

  • HTTP requests by sockets rather than Bridge/Bridgetalk?

    Has anyone brought this up before? I came across this article that's an implementation of HTTP requests using sockets rather than Bridge's HttpConnection class/object, so this should execute w/o dependency on Bridge/Bridgetalk I believe. I haven't tr

  • User-activated link  to sound file

    How do I create a user-activated link to a sound file that will simply play the sound without either (a) launching a free-floating controller for the sound or (b) rendering the sound visible on a new blank page? Doing this: <a href="boing.wav">BOING<