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
1
Sketch for a Name
By
Kaustubh Patil
Run
# change line 28 to your own name to get a unique pattern for your name def sketch_name(name): name = name.lower() r, g, b = get_rgb_for_name(name) max_a_factor = 26 * len(name) for i, letter in enumerate(name, start=1): letter_index = ord(letter) - ord("a") a = (((letter_index+1) * i) % max_a_factor) / max_a_factor c = circle( r=i*3, fill=color(r=r, g=g, b=b, a=a), stroke="none" #stroke=color(r=r, g=g, b=b) ) show( c | translate(x=(letter_index + 2)*3) | repeat(12, rotate(angle=30)) ) def get_rgb_for_name(name): name_factor = ord(name and name[0] or "a") random_factor = 42 rgb = [0, 0, 0] for i in range(3): rgb[i] = 20 + ((name_factor * random_factor * (i+1)) % 235) return rgb sketch_name("kaustubh") # inspired by rasagy.in
Comments
Want to discuss?
Post it here, our mentors will help you out.
Login