Does anyone have decent code for an HTML5 (canvas) sonar sweep?

Currently, I use a Google Chart to image my sonar sweep onto the web control page ..... once the scan has completed...  yeah...Too little too late.


I'm going to embark on coding the HTML5/Jscript  tonight if nothing exists that I can pilfer.. .er ... borrow.

What I'm looking for is a scan that takes "angle,distance"  pairs, and maps them onto a HTML5 canvas (of course removing previous one for that relative angle) and then doing a "lineto(x,y)" from the previous one. 


I *have* seen several demos for audio "ping" demos, but not with the radar style sweep that I would like to employ...


If you have written, used, seen, or heard about somethin in the public domain... please let me know.


Either way, I will post what I come up with, here.


Not quite the language you wanted but…

Here is a Processing sketch that I use all the time. Sure, it’s java-ish processing, not exactly what you wanted but should point your in the right direction and or should be easy to translate.

Thats very cool, much better
Thats very cool, much better than my first attempt, i think i’ll need to update now. This was my attempt

Very nice! Ok… I’ll be pilfering pieces for sure! Thx!

Very similar to some of the code I’ve already written… Polar to Cartesian mapping is pretty well documented… however I really like your concept of averaging consecutive sweeps and fading away the old trace… 

I’ll repost my HTML5 canvas code with sample data tonight.


Greatly appreciated Chris.