SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jul 2007
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    simple curveTo animation

    hi
    i have two movieclips "mc1" and "mc2"

    when the movie starts i would like to draw a curve between these two

    like you can see it here
    http://www.virginamerica.com/va/infoDeskRouteMap.do

    i know how to draw a static curve, but i would like to have it animated.
    perhaps anyone could give me a code example

    thank you

    pete

    PHP Code:
    _root.mc1;
    _root.mc2;

    this.onEnterFrame = function() {

    curveTo(???);

    thank you

  2. #2
    SitePoint Guru krityx's Avatar
    Join Date
    Jan 2006
    Location
    Around
    Posts
    634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    here's the script for drawing a curve between mc1 and mc2.
    Code Actionscript:
    _root.lineStyle(0, 0x000000, 100);
    _root.moveTo(mc1._x,mc1._y);
    _root.curveTo(300, 100, mc2._x, mc2._y);

    to draw something in flash using lineTo or curveTo you must first set a lineStyle which basically is how your line or curve will look like.

    Then the moveTo() function represents the point where you start drawing so in this case mc1. If you don't specify any values for this the default ones are 0,0 so it will begin drawing from those coordinates.

    Next, the curveTo function
    Syntax : curveTo(controlX:Number, controlY:Number, anchorX:Number, anchorY:Number)

    Ok so the controlX and controlY values refer to how curved you want your line to be. and the anchorX and anchorY refer to where you want your line to end, in this case mc2. you can play around with controlX and controlY values until you get the desired effect.

    Good luck.



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •