Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,979
    Thanks
    120
    Thanked 76 Times in 76 Posts

    dynamic draw line

    Is there a sample js that can dynamicaly draw line, without flickring,crossbrowser, etc. Like you have a point and another and dynamicaly draw line between as one of them move around with dragging.

    Tryed this (using images): http://www.p01.org/releases/Drawing_lines_in_JavaScript

    It turns out bad.

    The line could be dashed, dotted, no need for whole line.
    Found a flower or bug and don't know what it is ?
    agrozoo.net galery
    if you don't spot search button at once, there is search form:
    agrozoo.net galery search

  • #2
    Senior Coder jmrker's Avatar
    Join Date
    Aug 2006
    Location
    FL
    Posts
    3,097
    Thanks
    38
    Thanked 498 Times in 492 Posts
    Try using the "canvas" in the later browsers...
    Google: "javascript canvas" for a ton of examples.

    If you are trying to draw a line with the mouse,
    see: http://www.codingforums.com/showthread.php?t=224874

  • Users who have thanked jmrker for this post:

    BubikolRamios (05-25-2011)

  • #3
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,979
    Thanks
    120
    Thanked 76 Times in 76 Posts
    That example of yours works, slow doh, but if I make line dotted then it is useful.

    Thanks.
    Found a flower or bug and don't know what it is ?
    agrozoo.net galery
    if you don't spot search button at once, there is search form:
    agrozoo.net galery search

  • #4
    Senior Coder jmrker's Avatar
    Join Date
    Aug 2006
    Location
    FL
    Posts
    3,097
    Thanks
    38
    Thanked 498 Times in 492 Posts

    Question

    Quote Originally Posted by BubikolRamios View Post
    That example of yours works, slow doh, but if I make line dotted then it is useful.

    Thanks.
    What are you doing to make it so slow?
    Do you have example?

  • #5
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,979
    Thanks
    120
    Thanked 76 Times in 76 Posts
    not jet,busy lately with other things, but, replace in your code:
    Code:
    for( var i=0; i<lineLength; i++ )
    with
    Code:
    for( var i=0; i<lineLength; i=i+10 )
    click, wave with mouse around, you will se 'big' difference.
    If there are several lines to be drawn at same time, that exponentialy slows things down
    Found a flower or bug and don't know what it is ?
    agrozoo.net galery
    if you don't spot search button at once, there is search form:
    agrozoo.net galery search


  •  

    Posting Permissions

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