You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importrequestsimportiofromPILimportImageclassTestScene(Scene):
defconstruct(self):
headers= {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}
response=requests.get("https://raw.githubusercontent.com/ManimCommunity/manim/main/logo/cropped.png", headers=headers)
image_bytes=io.BytesIO(response.content)
image=Image.open(image_bytes)
defreflect_across(self, line, **kwargs):
A=line.get_start()
B=line.get_end()
AB=B-AP=self.get_center()
AP=P-ABP=P-Bperp_to_AB=AP-AB*(np.dot(AP, AB))/(np.linalg.norm(AB)**2)
self.flip(AB).shift(-2*perp_to_AB)
returnself# This binds the defined function reflect_across to the mobject class as if it were a native manim mobject method# This isn't necessary but it does allow the function to be used like any established mobject method, such as rotate, shift, etc.setattr(Mobject, "reflect_across", reflect_across)
flipflop=ImageMobject(image)
rect=SurroundingRectangle(flipflop)
line=Line(3*DL, 2*UP+2*LEFT)
self.add(flipflop, rect, line)
self.wait()
self.play(flipflop.animate.reflect_across(line), rect.animate.reflect_across(line), run_time=3)
self.wait()
self.play(flipflop.animate.reflect_across(line), rect.animate.reflect_across(line), run_time=3)
self.wait()
self.play(flipflop.animate.reflect_across(line), rect.animate.reflect_across(line), run_time=3)
Description of bug / unexpected behavior
When trying to rotate an Image() around an axis in the XY-plane the image is also rotated around the Z-axis and thus cannot be mirrored.
Expected behavior
When rotating a 2D-object 180° around an axis in the XY-plane it should end up mirrored on the scene.
How to reproduce the issue
A follow up from the discussion on Discord
https://discord.com/channels/581738731934056449/1027662457130455081
Code for reproducing the problem
Additional media files
Images/GIFs
see here:
https://discord.com/channels/581738731934056449/1027662457130455081/1028225119857950720
System specifications
System Details
LaTeX details
FFMPEG
Output of
ffmpeg -version
:The text was updated successfully, but these errors were encountered: