
    &e#                         d dl T 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
 d Zd Zd	 Zd
 ZdedededefdZ G d de          ZdS )    )*)VoiceoverScene)GTTSService)Vector)chunked)Vector3c                  J    t          d                              d          } | S )Nz&resources/ps_color_button_triangle.svg      ?
SVGMobjectscalebuttons    2/home/eirexe/repos/phvideos/1_tickless/tickless.pycreate_button_triangler   	   s#    @AAGGMMFM    c                  J    t          d                              d          } | S )Nz$resources/ps_color_button_square.svgr
   r   r   s    r   create_button_squarer      s#    >??EEdKKFMr   c                  J    t          d                              d          } | S )Nzresources/ps_color_button_x.svgr
   r   r   s    r   create_button_xr      s#    9::@@FFFMr   c                  J    t          d                              d          } | S )Nzresources/ps5_r1.svgr
   r   r   s    r   create_button_r1r      s#    .//55d;;FMr   abtreturnc                     d|z
  | z  ||z  z   S )zLinear interpolate on the scale given by a to b, using t as the point on that scale.
    Examples
    --------
        50 == lerp(0, 100, 0.5)
        4.2 == lerp(1, 5, 0.8)
        )r   r   r   s      r   lerpr       s     EQ;Qr   c                       e Zd Zd ZdS )
PHTicklessc           
      $   |                      t          dd                     t                              d           |                     d          5  |                                  d d d            n# 1 swxY w Y   t          d          }t          dt          d	z  
          }|                     d          5  |                    |t                     | 	                    t          |          t          |                     |                                  |                                  | 	                    t          |          t          |                     d d d            n# 1 swxY w Y   |                     d          5  g }g }d}d}t          |          D ];}t          d||z  d	z  dt          t                     }|                    |           <t%          |                                  t          |          D ]s}t          t)          |dz             t          d	z  t*                    }	|                    |	           |	                    ||                                                    t | j	        d |D             d |D             z     g }
g }d}t          |          D ]}|d	z  }|d	k    r||z  }nd|z
  |z  |dz
  z  }||                                         }|                    |           |d	k    rt          nt4          }|d	k    rt           nt6          }|                    ||           |                    |           |
                    t;          ||         |                     t%          |                                  t          |          D ]M}|
                    ||         j                            ||                                                              N|d	         }t          dt          dz  
                              |                    tA          tB          tD          z                       tB                    }t          dt          dz  
                              |                    tA          tB          tF          z                       tB                    }|
t          |          t          |          gz  }
| $                    d            | j	        |
  |                    tA          t          tD          z                       }tK          |t          z   |          }t          dt          dz  
          }|                    |t                     |                    tA          t          tF          z                       }g d}tM                      tO                      tQ                      tS                      g}g }g }g }g }|                    tA          tB          tD          z                       }|                    tA          tB          tF          z                       }tT          +                    g           } tY          ||          D ]\  }!}"t[          |||!          }#tK          |#t          z   |#          }$|"}%|%                    |$t                     |t]          |%          t]          |$          gz  }|                    |$           t          d|!z  ddt          dz  
          }&|&                    |%t                     |                    t          |&                     t[          |||!          }'| /                                rta          | |'tB          d !          }(t          d"tc          te          |          d	z  dz              t          dz  
          })|(3                    |)          }*|                    |(           |                    |)           |                    ti          |(                     |                    t          |)                     |'} ta          t[          |||d#                   |d$%          }+t          d&t          dz  
          },|+3                    |,           | 	                    t]          |          t          |                     | $                    d'           |d#                                         }-tK          |t          z   |          }.|-                    |.t                      | j	        |d d	           | $                    d(           | 	                    ti          |+          t          |,          t]          |-          t]          |.                     | $                    d)           | 	                    tk          |+          tk          |,          tm          |-          tm          |.                     | 	                    |d	                    to          |d*d          d*+          D ]\  }/}0}1 | j	        |/|0|1g  | $                    d,            | j	        |  d d d            d S # 1 swxY w Y   d S )-Nenbase)transcription_modelz	Noto Sans)fonta  
            In Project Heartbeat mere milliseconds can mean the difference between a record breaking run or an absolute failure.
            As a result, we are in an everlasting quest to lower latency and increase input consistency.
            With Project Heartbeat 2's new game engine, we've replaced the input system and developed cutting-edge rhythm game technology.
            zTickless systemzRhythm gaming... evolved?   )	font_sizez
            The game's logic is now completely dettached from the framerate, through the new advanced tickless system developed specifically for Project Heartbeat.
            a-  
            In previous versions of Project Heartbeat, <bookmark mark='input_check'/>your input used to only get checked once at the start of each frame.
            Any <bookmark mark='button_press'/>button presses you did after that got snapped to the start of the next frame.
            <bookmark mark='lag_incident'/>With the tight and fast gameplay of Project Heartbeat, this could mean the difference between getting a FINE rating and failing a perfect run.
            <bookmark mark='extra_buttons'/> With the new subtick system this no longer matters, <bookmark mark='show_tickless'/>the game now knows when you've pressed every single note and is able to precisely evaluate it.
            <bookmark mark='show_tickless'/> Effectively acting as if you were running an infinite frame rate.
                  g      ?r   )fill_opacitywidthheightstroke_color
fill_color)r)   colorc                 ,    g | ]}t          |          S r   )Create).0rs     r   
<listcomp>z(PHTickless.construct.<locals>.<listcomp>T   s    777aq		777r   c                 ,    g | ]}t          |          S r   )Write)r4   ns     r   r6   z(PHTickless.construct.<locals>.<listcomp>T   s    :[:[:[588:[:[:[r   g333333?)r-   )r/   r0   z0 msz16.666... msinput_checkzRead inputs)r
   g?gRQ?gffffff?g0@z.4fz msg      ?)	directionbuffzSubtick r   g?)r<   z&Delayed until the start of next frame!button_presslag_incidentextra_buttons   )r9   show_tickless)8set_speech_servicer   Textset_default	voiceoverwait_for_voiceoverDEFAULT_FONT_SIZEnext_toDOWNplayr8   waitUnwriterange	RectanglePURPLE_DPURPLE_CappendGrouparrangestrBLACKmove_to
get_centercopystretch_to_fit_widthPURPLE_BPURPLE_A	set_style	Transformanimateget_critical_point	normalizeUPLEFTRIGHTwait_until_bookmarkArrowr   r   r   r   nparrayzipinterpolate_arraysr3   anyBraceBetweenPointsintlen
put_at_tipGrowFromCenterFadeOutUncreater   )2selftickless_titletickless_subtitleframe_rectsframe_numbersFRAMES_TO_SHOWGRAPH_WIDTHi	frame_rct	frame_nmb
animationsnew_frame_rectsBIG_FRAME_PERCENTAGEr-   rectstrokefill	big_framecorner_time_startcorner_time_endframe_start_arrow_endframe_start_arrowread_inputs_textframe_rect_endBUTTON_PRESS_ARROW_TIMESBUTTON_PRESS_ICONSbutton_press_arrowsbutton_presses_animationsbutton_press_bracesbutton_press_braces_animationsbrace_start_pointbrace_end_pointprev_posr   icbutton_press_arrow_endbutton_press_arrowr   
time_labelbrace_pbrtxbrt	lag_bracelag_brace_tphantom_buttonphantom_arrowa1a2a3s2                                                     r   	constructzPHTickless.construct#   s   Df M M MNNNk***^^  	& 	& ##%%%	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& /00 !<HYZ[H[\\\^^
 
 		K 		K
 %%nd;;;IIeN++U3D-E-EFFF##%%%IIKKKIIgn--w7H/I/IJJJ		K 		K 		K 		K 		K 		K 		K 		K 		K 		K 		K 		K 		K 		K 		K ^^
 
 F	7 F	7 KMNK>** . .%3{>?Y[\>\efu}  KS  T  T  T	""9----;'')))>** ? ? QqS5Fq5HPUVVV	$$Y///!!+a.";";"="=>>>>DI77;777:[:[]:[:[:[[\\J O#' >** C C#A66058EE!$88EAnUVFVWE"1~**,,))%)888%&!VV#$66xxxFtDDD&&t,,,!!)KND"A"ABBBB?#++--->** e e!!-"2":"B"B?STCUC`C`CbCb"c"cdddd'*I $V7H7J K K K S ST]TpTpqz{}  C  |C  rD  rD  UE  UE  GI  !J  !J">=Nq=PQQQYYZcZvZv  xA  BD  EJ  BJ  xK  xK  [L  [L  NP  Q  QO'((o&& J
 $$]333DIz"" %.$@$@4PT9AUAU$V$V! %&;d&BDY Z Z#M=Nq=PQQQ$$%6===&99)DJ:O:OPPN( ( ($ %&&&(( ""!!	" #%(*%"$-/* !* < <Yr$w=O=O P P'::9RX;N;NOOOxx||H79KLL # #B);<QSacd)e)e&%*+AD+HJ`%a%a"14888)fVnnfEW>X>X-YY)#**+=>>>!o&9"C"C"C"CO`abObccc
""64000)00z1B1BCCC,->QRSS<<>> E+HgRUVVVBN#c2E.F.Fq.H.J*K*KNNZklmZmnnnB--++C'..r222'..r222299.:L:LMMM299%))DDD"*+=>SUce}~  fA  ,B  ,B  DR  Y\  ]  ]  ]IGSdefSfgggK  ---IIf.//7G1H1HIII$$^444/27799N!.4"7HHM""=$777DI0!455$$^444IInY//{1C1CVNE[E[]cdq]r]rsss$$_555IIgi(('+*>*>@X@XZbcpZqZqrrrII/2333%&?&CqIII ) )
B	BB<((($$_555DI566MF	7 F	7 F	7 F	7 F	7 F	7 F	7 F	7 F	7 F	7 F	7 F	7 F	7 F	7 F	7 F	7 F	7 F	7s8   A66A:=A:>B$E..E25E2c*jj	j	N)__name__
__module____qualname__r   r   r   r   r"   r"   "   s(        a7 a7 a7 a7 a7r   r"   N)manimmanim_voiceoverr   manim_voiceover.services.gttsr   vectorsr   more_itertoolsr   pyrrr   r   r   r   r   floatr    r"   r   r   r   <module>r      s       * * * * * * 5 5 5 5 5 5       " " " " " "              E e  %    b7 b7 b7 b7 b7 b7 b7 b7 b7 b7r   