Explore
Courses
Batches
Sketches
Statistics
Code a Pookkalam
Jobs
Devsprint
People
Course Creation
Create a Course
Guidelines
Resources
Support
Blogs
My Profile
About Us
Login
Sketches
0
Arc
By
Anand Chitipothu
Run
import math def path(d, stroke_width=1, fill="none", stroke="black"): return Shape("path", d=d, stroke_width=stroke_width, fill=fill, storke=stroke) # Drawing an arc is tricky in SVG. # The following function tries to simplify drawing an arc. # https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#arcs def arc(angle, **kwargs): x = 100 * math.cos(math.radians(angle)) y = 100 * math.sin(math.radians(angle)) long_flag = int(angle > 180) d = f"M 100 0 A 100 100 0 {long_flag} 1 {x} {y}" return path(d, **kwargs) shape = arc(135) show(shape)
Comments
Want to discuss?
Post it here, our mentors will help you out.
Login