
    ljL8                       U d Z ddlmZ dgZddlmZ ddlZddlm	Z	 ddl
mZ ddlmZmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZmZ ddlmZmZ ddlmZ ddl m!Z! ddl"m#Z# ddl$m%Z%m&Z&  ej'        d           ej'        d           ej'        d           ej'        d           ej'        d          gZ(de)d<    G d de#          Z*dS )z&Utilities for Manim's logo and banner.    )annotationsManimBanner)AnyN)UpdateFromAlphaFunc)Circle)SquareTriangle)Mobject)Vector3D   )	constants)override_animation)AnimationGroup
Succession)CreateSpiralIn)FadeIn)VMobjectFromSVGPath)VGroup)ease_in_out_cubicsmootha  M4.64259-2.092154L2.739726-6.625156C2.660025-6.824408 2.650062-6.824408 2.381071-6.824408H.52802C.348692-6.824408 .199253-6.824408 .199253-6.645081C.199253-6.475716 .37858-6.475716 .428394-6.475716C.547945-6.475716 .816936-6.455791 1.036115-6.37609V-1.05604C1.036115-.846824 1.036115-.408468 .358655-.348692C.169365-.328767 .169365-.18929 .169365-.179328C.169365 0 .328767 0 .508095 0H2.052304C2.231631 0 2.381071 0 2.381071-.179328C2.381071-.268991 2.30137-.33873 2.221669-.348692C1.454545-.408468 1.454545-.826899 1.454545-1.05604V-6.017435L1.464508-6.027397L3.895392-.209215C3.975093-.029888 4.044832 0 4.104608 0C4.224159 0 4.254047-.079701 4.303861-.199253L6.744707-6.027397L6.75467-6.017435V-1.05604C6.75467-.846824 6.75467-.408468 6.07721-.348692C5.88792-.328767 5.88792-.18929 5.88792-.179328C5.88792 0 6.047323 0 6.22665 0H8.886675C9.066002 0 9.215442 0 9.215442-.179328C9.215442-.268991 9.135741-.33873 9.05604-.348692C8.288917-.408468 8.288917-.826899 8.288917-1.05604V-5.768369C8.288917-5.977584 8.288917-6.41594 8.966376-6.475716C9.066002-6.485679 9.155666-6.535492 9.155666-6.645081C9.155666-6.824408 9.006227-6.824408 8.826899-6.824408H6.90411C6.645081-6.824408 6.625156-6.824408 6.535492-6.615193L4.64259-2.092154ZM4.343711-1.912827C4.423412-1.743462 4.433375-1.733499 4.552927-1.693649L4.11457-.637609H4.094645L1.823163-6.057285C1.77335-6.1868 1.693649-6.356164 1.554172-6.475716H2.420922L4.343711-1.912827ZM1.334994-.348692H1.165629C1.185554-.37858 1.205479-.408468 1.225405-.428394C1.235367-.438356 1.235367-.448319 1.24533-.458281L1.334994-.348692ZM7.103362-6.475716H8.159402C7.940224-6.22665 7.940224-5.967621 7.940224-5.788294V-1.036115C7.940224-.856787 7.940224-.597758 8.169365-.348692H6.884184C7.103362-.597758 7.103362-.856787 7.103362-1.036115V-6.475716Za  M1.464508-4.024907C1.464508-4.234122 1.743462-4.393524 2.092154-4.393524C2.669988-4.393524 2.929016-4.124533 2.929016-3.516812V-2.789539C1.77335-2.440847 .249066-2.042341 .249066-.916563C.249066-.308842 .71731 .139477 1.354919 .139477C1.92279 .139477 2.381071-.059776 2.929016-.557908C3.038605-.049813 3.257783 .139477 3.745953 .139477C4.174346 .139477 4.483188-.019925 4.861768-.428394L4.712329-.637609L4.612702-.537983C4.582814-.508095 4.552927-.498132 4.503113-.498132C4.363636-.498132 4.293898-.587796 4.293898-.747198V-3.347447C4.293898-4.184309 3.536737-4.712329 2.321295-4.712329C1.195517-4.712329 .438356-4.204234 .438356-3.457036C.438356-3.048568 .67746-2.799502 1.085928-2.799502C1.484433-2.799502 1.763387-3.038605 1.763387-3.377335C1.763387-3.676214 1.464508-3.88543 1.464508-4.024907ZM2.919054-.996264C2.650062-.687422 2.450809-.56787 2.211706-.56787C1.912827-.56787 1.703611-.836862 1.703611-1.235367C1.703611-1.8132 2.122042-2.231631 2.919054-2.440847V-.996264ZaQ  M2.948941-4.044832C3.297634-4.044832 3.466999-3.775841 3.466999-3.217933V-.806974C3.466999-.438356 3.337484-.278954 2.998755-.239103V0H5.339975V-.239103C4.951432-.268991 4.851806-.388543 4.851806-.806974V-3.307597C4.851806-4.164384 4.323786-4.712329 3.506849-4.712329C2.909091-4.712329 2.450809-4.433375 2.082192-3.845579V-4.592777H.179328V-4.353674C.617684-4.283935 .707347-4.184309 .707347-3.765878V-.836862C.707347-.418431 .627646-.328767 .179328-.239103V0H2.580324V-.239103C2.211706-.288917 2.092154-.438356 2.092154-.806974V-3.466999C2.092154-3.576588 2.530511-4.044832 2.948941-4.044832Za  M2.15193-4.592777H.239103V-4.353674C.67746-4.26401 .767123-4.174346 .767123-3.765878V-.836862C.767123-.428394 .697385-.348692 .239103-.239103V0H2.6401V-.239103C2.291407-.288917 2.15193-.428394 2.15193-.806974V-4.592777ZM1.454545-6.884184C1.026152-6.884184 .67746-6.535492 .67746-6.117061C.67746-5.668742 1.006227-5.339975 1.444583-5.339975S2.221669-5.668742 2.221669-6.107098C2.221669-6.535492 1.882939-6.884184 1.454545-6.884184Za  M2.929016-4.044832C3.317559-4.044832 3.466999-3.815691 3.466999-3.217933V-.806974C3.466999-.398506 3.35741-.268991 2.988792-.239103V0H5.32005V-.239103C4.971357-.278954 4.851806-.428394 4.851806-.806974V-3.466999C4.851806-3.576588 5.310087-4.044832 5.69863-4.044832C6.07721-4.044832 6.22665-3.805729 6.22665-3.217933V-.806974C6.22665-.388543 6.117061-.268991 5.738481-.239103V0H8.109589V-.239103C7.721046-.259029 7.611457-.37858 7.611457-.806974V-3.307597C7.611457-4.164384 7.083437-4.712329 6.266501-4.712329C5.69863-4.712329 5.32005-4.483188 4.801993-3.845579C4.503113-4.473225 4.154421-4.712329 3.526775-4.712329S2.440847-4.443337 2.062267-3.845579V-4.592777H.179328V-4.353674C.617684-4.293898 .707347-4.174346 .707347-3.765878V-.836862C.707347-.428394 .617684-.318804 .179328-.239103V0H2.550436V-.239103C2.201743-.288917 2.092154-.428394 2.092154-.806974V-3.466999C2.092154-3.58655 2.530511-4.044832 2.929016-4.044832Zzlist[se.Path]MANIM_SVG_PATHSc                  h     e Zd ZdZdd fdZd fdZ ee          ddd            ZdddZ	 xZ
S )r   a  Convenience class representing Manim's banner.

    Can be animated using custom methods.

    Parameters
    ----------
    dark_theme
        If ``True`` (the default), the dark theme version of the logo
        (with light text font) will be rendered. Otherwise, if ``False``,
        the light theme version (with dark text font) is used.

    Examples
    --------
    .. manim:: DarkThemeBanner

        class DarkThemeBanner(Scene):
            def construct(self):
                banner = ManimBanner()
                self.play(banner.create())
                self.play(banner.expand())
                self.wait()
                self.play(Unwrite(banner))

    .. manim:: LightThemeBanner

        class LightThemeBanner(Scene):
            def construct(self):
                self.camera.background_color = "#ece6e2"
                banner = ManimBanner(dark_theme=False)
                self.play(banner.create())
                self.play(banner.expand())
                self.wait()
                self.play(Unwrite(banner))

    T
dark_themeboolc                   t                                                       d}d}d}d}|rdnd| _        d| _        t	          t
          d                                       t          j                  	                                | _
        | j
                            d	                              d
t          j        z  t          j        z             | j
                            | j        d                              dt          j        z  dt          j        z  z              t'          |d                              t          j                  | _        t+          |d                              t          j                  | _        t/          |d                              t          j                  | _        t3          | j        | j        | j                  | _        |                     | j        | j
                   |                     t          j                   t3                      }t=          t
          dd                    D ]\  }}t	          |                              t          j                  	                                }	|	                    d	                              t          j        t          j        z             |dk    r|	                    |d           |	                     | j
        t          j!                   |                    |	           |                    | j        d           || j
        j"        z  |_"        || _#        d S )Nz#81b29az#454866z#e07a5fgwkF=?z#ece6e2z#343434g      ?r   )stroke_width      )coloropacityg      @      ?)r    fill_opacityg{Gz?buff)$super__init__
font_colorscale_factorr   r   flipcstRIGHTcenterMsetscaleDEFAULT_FONT_SIZESCALE_FACTOR_PER_FONT_POINTset_fillshiftLEFTUPr   circler   squarer	   triangler   shapesaddmove_toORIGIN	enumeratenext_toalign_toDOWNheightanim)selfr   
logo_green	logo_bluelogo_redm_height_over_anim_heightrC   indpathtex	__class__s             M/home/agentuser/manim-venv/lib/python3.11/site-packages/manim/mobject/logo.pyr'   zManimBanner.__init__   s   
	$+!'1@))y$_Q%788==ciHHOOQQ


""((%%(GG	
 	
 	
 	doq99??38OcCFl*	
 	
 	
 :A>>>DDSXNN91===CCCFKK xa@@@FFsyQQT]DKEEdf%%%SZ   xx"?122#677 	 	IC%d++00;;BBDDCGGG##))%(GG   QwwDt,,,LL***HHSMMMMDOQ777/$&-? 			    r)   floatkwargsr   returnc                    | xj         |z  c_         | j        | j        vr | j        j        |fi |  t	                      j        |fi |S )a  Scale the banner by the specified scale factor.

        Parameters
        ----------
        scale_factor
            The factor used for scaling the banner.

        Returns
        -------
        :class:`~.ManimBanner`
            The scaled banner.
        )r)   rC   submobjectsr0   r&   )rD   r)   rP   rL   s      rM   r0   zManimBanner.scale   sc     	\)9D,,,DIOL33F333uww}\44V444rN   r   run_timer   c                |    t          t          | j        |          t          | j        |dz            d          S )a  The creation animation for Manim's logo.

        Parameters
        ----------
        run_time
            The run time of the animation.

        Returns
        -------
        :class:`~.AnimationGroup`
            An animation to be used in a :meth:`.Scene.play` call.
        )rT   r   g?)	lag_ratio)r   r   r:   r   r.   )rD   rT   s     rM   createzManimBanner.create   sF     T[844446HqL111
 
 
 	
rN   r"   r-   	directionstrr   c           	        	
 dvrt          d          d j        z   j        dz  	d} j                             j        |                               j        t          j                    j                            d            j	        
                                  j        d                                                                                              j	                    j        
                                 t           j         j                  d fd
d 	
fd}d	
fd}t          t!           ||dz  dz  t"                    t!           ||dz  dz  t$                              S )az  An animation that expands Manim's logo into its banner.

        The returned animation transforms the banner from its initial
        state (representing Manim's logo with just the icons) to its
        expanded state (showing the full name together with the icons).

        See the class documentation for how to use this.

        .. note::

            Before calling this method, the text "anim" is not a
            submobject of the banner object. After the expansion,
            it is added as a submobject so subsequent animations
            to the banner object apply to the text "anim" as well.

        Parameters
        ----------
        run_time
            The run time of the animation.
        direction
            The direction in which the logo is expanded.

        Returns
        -------
        :class:`~.Succession`
            An animation to be used in a :meth:`.Scene.play` call.

        Examples
        --------
        .. manim:: ExpandDirections

            class ExpandDirections(Scene):
                def construct(self):
                    banners = [ManimBanner().scale(0.5).shift(UP*x) for x in [-2, 0, 2]]
                    self.play(
                        banners[0].expand(direction="right"),
                        banners[1].expand(direction="center"),
                        banners[2].expand(direction="left"),
                    )

        )leftrightr-   z.direction must be 'left', 'right' or 'center'.g      @g?gQ?r$   r   vectorr   rQ   Nonec                   j                                                              j        j        t
          j                   dk    rj                             |            d S dk    r8j                             | dz                                 |  dz             d S dk    r                    |             d S d S )Nr\   r-   r   r[   )r:   restorer@   r.   saved_stater+   r5   r4   )r^   rX   
left_grouprD   s    rM   r4   z!ManimBanner.expand.<locals>.shift  s    K!!! 2CH===G##!!&)))))h&&!!&1*---  &1-----f$$  &))))) %$rN   mobr
   alpharO   c                    |z   z  t           j        z             | j        D ]g}| j                                        d         |                                d         k    r*|                    d                               |           h|dk    rx j        j        g                      j                   | j        	                    d           | j        
                                 | j        
                                 d S d S )Nr   r   )r+   r,   rC   r8   
get_centerset_opacityadd_to_backremover:   set_z_index
save_stater.   )rd   re   letterm_shape_offsetrD   shape_sliding_overshootr4   s      rM   slide_and_uncoverz-ManimBanner.expand.<locals>.slide_and_uncover'  s   E%>,CCDsyPQQQ ( - -:((**1-0A0A0C0CA0FFF&&q)))$$V,,, zzdi[))  +++
&&q)))
%%'''  """"" zrN   c                V   |dk    rO                     d                               | j        d                    | j                             d            |z  t          j        z             |dk    r1|                                |                     | j                   d S d S )Nr   r   r]   )rh   r<   rC   r+   r5   rj   ri   r:   )rd   re   m_clonero   r4   s     rM   
slide_backz&ManimBanner.expand.<locals>.slide_back8  s    zz##A&&&---$$Q'''E%11CH<===zz

7###
+++++ zrN   r      )rT   	rate_funcr   )r^   r   rQ   r_   )rd   r
   re   rO   rQ   r_   )
ValueErrorr)   rC   r?   r.   r@   r+   rA   rh   r:   rl   copyr;   r<   r   r   r   r   r   )rD   rT   rX   m_anim_buffrp   rs   rc   rr   rn   ro   r4   s   ` `   @@@@@rM   expandzManimBanner.expand   s   T 777MNNN 11"&"3c"9	$&{33<<TVSXNNN	a      )B-$$&&$$$DFDIw77
		* 		* 		* 		* 		* 		* 		* 		*	# 	# 	# 	# 	# 	# 	# 	# 	#"
	, 
	, 
	, 
	, 
	, 
	, 
	, 
	, !!A)+	    !A) 	  
 
 	
rN   )T)r   r   )r)   rO   rP   r   rQ   r   )r   )rT   rO   rQ   r   )r"   r-   )rT   rO   rX   rY   rQ   r   )__name__
__module____qualname____doc__r'   r0   r   r   rW   ry   __classcell__)rL   s   @rM   r   r   k   s        " "H) ) ) ) ) ) )V5 5 5 5 5 5& 
 
 
 
  
&o
 o
 o
 o
 o
 o
 o
 o
 o
rN   )+r}   
__future__r   __all__typingr   svgelementssemanim.animation.updaters.updater   manim.mobject.geometry.arcr   manim.mobject.geometry.polygramr   r	   manim.mobject.mobjectr
   manim.typingr    r   r+   animation.animationr   animation.compositionr   r   animation.creationr   r   animation.fadingr   mobject.svg.svg_mobjectr    mobject.types.vectorized_mobjectr   utils.rate_functionsr   r   Pathr   __annotations__r    rN   rM   <module>r      s"   , , , " " " " " "/           ? ? ? ? ? ? - - - - - - < < < < < < < < ) ) ) ) ) ) ! ! ! ! ! !       4 4 4 4 4 4 > > > > > > > > 1 1 1 1 1 1 1 1 % % % % % % 9 9 9 9 9 9 5 5 5 5 5 5 < < < < < < < < BG	@ 6 BG	3   BG	
 
 BG	Q  BG	D N" N N N Nbf
 f
 f
 f
 f
& f
 f
 f
 f
 f
rN   