A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: How can i make a line seem to draw itself?

  1. #1
    Member
    Join Date
    Sep 2001
    Posts
    97
    I have a line which I would like to start off small, then grow longer, as if it is being drawn by an invisible pencil.

    Is this possible in Swish and how do I do it?

    Thanks,
    JonathanBull33

  2. #2
    Chief of Molecules wcoleman's Avatar
    Join Date
    Nov 2000
    Location
    Massachusetts
    Posts
    3,975
    As long as you are talking straight lines it is trivial - curved lines are a little harder. Here is an old example of mine done using transforms - http://www.wellesley.edu/Chemistry/Flick/linesq3.swf and http://www.wellesley.edu/Chemistry/Flick/linesq3.swi

    Cheers,

    Flick


  3. #3
    Swiftdev Founder 98svt's Avatar
    Join Date
    May 2001
    Location
    Royal Oak, Michigan
    Posts
    2,139
    Thats alot of of lines Flick!
    Mike

  4. #4
    Junior Member
    Join Date
    Feb 2002
    Posts
    28
    that was good. but the the question was how do you do it?


  5. #5
    Chief of Molecules wcoleman's Avatar
    Join Date
    Nov 2000
    Location
    Massachusetts
    Posts
    3,975
    Originally posted by jobalistic
    that was good. but the the question was how do you do it?

    There are manay ways to do this. If you look at the swi file for the example I gave each line is given a transform effect that lengthens the line by 200 pixels and moves the center by 100 pixels, thus leaving one end fixed. Another way would be to set the left center as the pivot point and draw a line 200 pixels long, then in the transform panel set it to 0% length at the first frame, apply a transform effect that only changes the x value and move it to the right by how ever many pixels you wish. Another would be to draw a line of the length you want at the end of the effect, set it to 0% in the first frame and set the pivot at the left center, then apply a move effect to resize to 100%. No matter what your approach you should have zero set for the line width or it will grow in width as well as length. http://www.wellesley.edu/Chemistry/Flick/twolines.swf and http://www.wellesley.edu/Chemistry/Flick/twolines.swi show two different methods of drawing a line. Look at the details of the settings for the transform and move effects that are applied.

    Cheers,

    Flick

  6. #6
    Junior Member
    Join Date
    Feb 2002
    Posts
    28

    wow thanks!!! last question

    thnaks for the help however is this also the same case if i want to make a line turn to a corner??


  7. #7
    Chief of Molecules wcoleman's Avatar
    Join Date
    Nov 2000
    Location
    Massachusetts
    Posts
    3,975

    Re: wow thanks!!! last question

    Originally posted by jobalistic
    thnaks for the help however is this also the same case if i want to make a line turn to a corner??

    That would then be two lines - finish one and then immediately begin the next - look at http://www.wellesley.edu/Chemistry/Flick/drawsquare.swi

    Cheers,

    Flick

  8. #8
    Junior Member
    Join Date
    Feb 2002
    Posts
    1

    drawing line

    Originally posted by wcoleman
    Originally posted by jobalistic
    that was good. but the the question was how do you do it?

    There are manay ways to do this. If you look at the swi file for the example I gave each line is given a transform effect that lengthens the line by 200 pixels and moves the center by 100 pixels, thus leaving one end fixed. Another way would be to set the left center as the pivot point and draw a line 200 pixels long, then in the transform panel set it to 0% length at the first frame, apply a transform effect that only changes the x value and move it to the right by how ever many pixels you wish. Another would be to draw a line of the length you want at the end of the effect, set it to 0% in the first frame and set the pivot at the left center, then apply a move effect to resize to 100%. No matter what your approach you should have zero set for the line width or it will grow in width as well as length. http://www.wellesley.edu/Chemistry/Flick/twolines.swf and http://www.wellesley.edu/Chemistry/Flick/twolines.swi show two different methods of drawing a line. Look at the details of the settings for the transform and move effects that are applied.

    Cheers,

    Flick
    Hi This is my first time as a member. I've been having problems trying to draw lines in Swish v2.0. I copied your method and it just didn't work for me. When I use the move effect with the exact settings you have I get a little dash that moves across the screen. What am I doing wrong. What size of line did you start with. 0x0??

  9. #9
    Swiftdev Founder 98svt's Avatar
    Join Date
    May 2001
    Location
    Royal Oak, Michigan
    Posts
    2,139
    Start with a line size of "0". Then add the move effect. At the last frame of the move effect, drag the end of the line to the point you want it drawn to.

    Mike

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center