javascript - Drawing a polygon with circles using java script canvas -


hi there way draw polygon circles using java script canvas, refer each circle object contains coordinates , index inside. want draw complete k-partite graphs visually. thanks

the canvas works lot in ms paint. once draw circle on computer forgets circle , remembers pixels. need keep track of yourself:

i haven't tested code below idea.

hopefully helps started: http://blog.nihilogic.dk/2009/02/html5-canvas-cheat-sheet.html

var canvas = document.getelementbyid("maincanvas"); var ctx = canvas.getcontext("2d"); var circles =[]; function addcircle(arg_x,arg_y,arg_rad){     var newcirc = {};     newcirc.x = arg_x     newcirc.y = arg_y     newcirc.rad = arg_rad     circles.push(newcirc) }  function redrawcirc(){     // loop through circles array , redraw entire graph     // whenever changes     for(var =0;i<circles.length;i++){         ctx.arc(circles[i].x,circles[i].y,circles[i].rad,0,math.pi*2);     } } 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -