Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-24-2011, 08:59 PM   PM User | #1
BubikolRamios
Senior Coder

 
Join Date: Dec 2005
Location: Slovenia
Posts: 1,876
Thanks: 114
Thanked 76 Times in 76 Posts
BubikolRamios is on a distinguished road
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
BubikolRamios is offline   Reply With Quote
Old 05-24-2011, 11:46 PM   PM User | #2
jmrker
Senior Coder

 
jmrker's Avatar
 
Join Date: Aug 2006
Location: FL
Posts: 2,765
Thanks: 29
Thanked 453 Times in 447 Posts
jmrker will become famous soon enough
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
jmrker is offline   Reply With Quote
Users who have thanked jmrker for this post:
BubikolRamios (05-25-2011)
Old 05-25-2011, 12:08 PM   PM User | #3
BubikolRamios
Senior Coder

 
Join Date: Dec 2005
Location: Slovenia
Posts: 1,876
Thanks: 114
Thanked 76 Times in 76 Posts
BubikolRamios is on a distinguished road
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
BubikolRamios is offline   Reply With Quote
Old 05-25-2011, 06:34 PM   PM User | #4
jmrker
Senior Coder

 
jmrker's Avatar
 
Join Date: Aug 2006
Location: FL
Posts: 2,765
Thanks: 29
Thanked 453 Times in 447 Posts
jmrker will become famous soon enough
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?
jmrker is offline   Reply With Quote
Old 05-26-2011, 05:12 PM   PM User | #5
BubikolRamios
Senior Coder

 
Join Date: Dec 2005
Location: Slovenia
Posts: 1,876
Thanks: 114
Thanked 76 Times in 76 Posts
BubikolRamios is on a distinguished road
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
BubikolRamios is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:34 AM.


Advertisement
Log in to turn off these ads.