Skip to content

drawing an arc on Canvas #418

Closed Answered by postspectacular
cdaein asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @cdaein, there's another way to draw elliptic arcs, but currently it's not compatible with using thi.ng/geom arcs (you'll have to use plain hiccup syntax for those shapes). I will explain below. Here's how you can draw elliptic arcs right now:

draw(ctx, [
	"ellipse",
	{ stroke: "#000" },
	// center
	[300, 300],
	// radii (x, y)
	[200, 100],
	// x-axis rotation
	0.5,
	// start angle (radians)
	0,
	// end angle (radians)
	Math.PI * 1.5,
	// counterclockwise flag
	false
]);

This is an old known issue (#69, also see related section in readme) and apart from the initial oversight on my part, it's actually much more down to incompatibilities between the HTML Canvas API and how arcs are defin…

Replies: 8 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by cdaein
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@postspectacular
Comment options

@cdaein
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@postspectacular
Comment options

@postspectacular
Comment options

@cdaein
Comment options

@postspectacular
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants