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
wavy flag
By
Kaustubh Patil
Run
flag_width = 150 flag_height = flag_width / 1.1 flag_section_height = flag_height / 3 ashoka_chakra_radius = flag_height / 10 def left_wave(h=25, w=50, fill="white", stroke="black"): x, y = -w / 2, 0 e = ellipse(x=x, y=y, w=w, h=h*2, fill=fill, stroke=stroke) r = rectangle(x=x, y=y-h/2, w=w, h=h, fill=fill, stroke="none") return e + r def right_wave(h=25, w=50, fill="white", stroke="black"): w = left_wave(h=h, w=w, fill=fill, stroke=stroke) return w | rotate(180) def left_flag_section(fill, stroke="none"): w = left_wave(w=100, h=33.3, fill=fill, stroke=stroke) r_lower = rectangle(w=100, h=33.3, y=-33.3/2, x=-50, fill=fill, stroke="none") return r_lower + w def right_flag_section(fill, stroke="none"): return left_flag_section(fill, stroke) | rotate(180) def flag(): left_part = ( (left_flag_section("orange") | translate(y=flag_section_height * 2)) + (left_flag_section("white") | translate(y=flag_section_height)) + left_flag_section("green") + (left_flag_section("white") | translate(y=-flag_section_height))) right_part = ( (right_flag_section("green") | translate(y=-flag_section_height)) + right_flag_section("white") + (right_flag_section("orange") | translate(y=flag_section_height)) + (right_flag_section("white") | translate(y=flag_section_height * 2))) ashoka_outline = circle(r=ashoka_chakra_radius, stroke="blue") ashoka_spoke = line(x1=0, y1=0, x2=ashoka_chakra_radius, y2=0, stroke="blue") ashoka_spokes = ashoka_spoke | repeat(24, rotate(360/24)) ashoka = ashoka_outline + ashoka_spokes return left_part + ((right_part) | translate(y=18, x=-4)) + (ashoka | translate(y=30)) show(flag()) # not-wavy flag... # flag_height = 100 # flag_width = flag_height * 1.5 # flag_section_height = flag_height / 3 # ashoka_chakra_radius = 12.5 # saffron_section = rectangle(h=flag_section_height, w=flag_width, fill="orange", stroke="none") # saffron_section = saffron_section | translate(y=flag_section_height * 2) # white_section = rectangle(h=flag_section_height, w=flag_width, fill="white", stroke="none") # ashoka_chakra_outline = circle(r=12.5, stroke="blue") # ashoka_chakra_spoke = line(x1=0, y1=0, x2=ashoka_chakra_radius, y2=0, stroke="blue") # ashoka_chakra_spokes = ashoka_chakra_spoke | repeat(24, rotate(360/24)) # ashoka_chakra = ashoka_chakra_outline + ashoka_chakra_spokes # white_section = white_section + ashoka_chakra # white_section = white_section | translate(y=flag_section_height) # green_section = rectangle(h=flag_section_height, w=flag_width, fill="green", stroke="none") # flag = saffron_section + white_section + green_section
Comments
Want to discuss?
Post it here, our mentors will help you out.
Login