tag:blogger.com,1999:blog-34454975.post6402513514622762140..comments2023-06-28T16:58:41.189+02:00Comments on Web Reflection: ellipse and circle for canvas 2d contextAndrea Giammarchihttp://www.blogger.com/profile/16277820774810688474noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-34454975.post-59313650801991288212013-07-01T15:38:11.344+02:002013-07-01T15:38:11.344+02:00Awesome dude!
Semicircle? you mean like a half on...Awesome dude! <br />Semicircle? you mean like a half one? just remove the two last bezierCurveTo;Anonymoushttps://www.blogger.com/profile/11828513300121269132noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-17854596911735284062012-01-27T01:55:53.454+01:002012-01-27T01:55:53.454+01:00Is there any similar function to draw a semicircle...Is there any similar function to draw a semicircle?Saranya SukumaRhttps://www.blogger.com/profile/01877661965132169803noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-9344436749007617942011-03-11T20:00:44.415+01:002011-03-11T20:00:44.415+01:00Here's the version I'm using now, which al...Here's the version I'm using now, which also can rotate the ellipse from its default axis alignment:<br /><br /><br /> // draw ellipse<br /> // r = radius of base circle<br /> // w,h = ratio of ellipse width,height to r<br /> // a = angle of rotation (radians) clockwise from orthogonal<br /> function ellipse(ctx, x, y, r, w, h, a) {<br /> ctx.beginPath();<br /> ctx.save();<br /> ctx.translate(x, y);<br /> ctx.rotate(a);<br /> ctx.scale(w, h);<br /> ctx.arc(0, 0, r, 0, Math.PI * 2);<br /> ctx.restore(); <br /> }<br /><br />It works.Larshttps://www.blogger.com/profile/03240201453848389345noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-24087354514094122732010-03-03T07:30:55.221+01:002010-03-03T07:30:55.221+01:00Yes, arc seems to be easier. And combining it with...Yes, arc seems to be easier. And combining it with scale you'll got an ellipse.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-34454975.post-88807523763840042182009-02-28T16:05:00.000+01:002009-02-28T16:05:00.000+01:00Why not use arc(To) to draw circles, maybe its fas...Why not use arc(To) to draw circles, maybe its faster?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-34454975.post-50471982081758943532009-02-26T10:08:00.000+01:002009-02-26T10:08:00.000+01:00oops, cheers :)oops, cheers :)Andrea Giammarchihttps://www.blogger.com/profile/16277820774810688474noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-27099147392317554742009-02-26T00:47:00.000+01:002009-02-26T00:47:00.000+01:00Thanks, but:s/strokeCircle:function(aX, aY, aWidth...Thanks, but:<BR/><BR/>s/strokeCircle:function(aX, aY, aWidth, aHeight)/strokeCircle:function(aX, aY, aDiameter)Anonymousnoreply@blogger.com