https://discord.com/channels/581738731934056449/1211276254620155954/1211286899474432051
Last active
February 25, 2024 14:21
-
-
Save uwezi/ede782a80398f9df42f3f933c0faf18a to your computer and use it in GitHub Desktop.
[text around circle] Placing a text around a circle. #manim #tex #placement
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://discord.com/channels/581738731934056449/1211276254620155954/1211286899474432051 | |
| from manim import * | |
| class roundTex(Scene): | |
| def construct(self): | |
| text = Tex(r"Lorem ipsum uwezi") | |
| radius = 2 | |
| circ = Circle(radius=radius) | |
| arclen = 180*DEGREES | |
| text.scale_to_fit_width(arclen*radius).move_to(ORIGIN, aligned_edge=DL) # wrap around upper half only | |
| y = text.get_bottom()[1] | |
| for glyph in text[0]: | |
| handle = glyph.get_center()[0]*RIGHT + y*UP | |
| glyph.rotate(-PI/2-handle[0]/radius, about_point=handle).shift(circ.point_at_angle(-handle[0]/radius)-handle) | |
| self.play(Create(circ)) | |
| self.play(Write(text)) | |
| self.play(Rotate(text, angle=-3*PI, about_point=circ.get_center())) | |
| self.wait() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
