
    -i	                     J    d dl mZ d dlmZ e G d de                      ZdS )    )	dataclass)Effectc                   N    e Zd ZU dZdZeed<   dZeed<   dZeed<   	 d	dZ	d Z
dS )

AccelDecelad  Accelerates and decelerates a clip, useful for GIF making.

    Parameters
    ----------

    new_duration : float
      Duration for the new transformed clip. If None, will be that of the
      current clip.

    abruptness : float
      Slope shape in the acceleration-deceleration function. It will depend
      on the value of the parameter:

      * ``-1 < abruptness < 0``: speed up, down, up.
      * ``abruptness == 0``: no effect.
      * ``abruptness > 0``: speed down, up, down.

    soonness : float
      For positive abruptness, determines how soon the transformation occurs.
      Should be a positive number.

    Raises
    ------

    ValueError
      When ``sooness`` argument is lower than 0.

    Examples
    --------

    The following graphs show functions generated by different combinations
    of arguments, where the value of the slopes represents the speed of the
    videos generated, being the linear function (in red) a combination that
    does not produce any transformation.

    .. image:: /_static/medias/accel_decel-fx-params.png
      :alt: acced_decel FX parameters combinations
    Nnew_duration      ?
abruptnesssoonnessc                 @    d|z   fd}| |||z  |z            z  S )Nr   c                 d    fdfd}| dk      |           z  | dk     ||           z  z   S )Nc                      ddz
  z  | z  z  S )N      ?    )tas    Y/var/www/html/speakWrite/venv/lib/python3.11/site-packages/moviepy/video/fx/AccelDecel.pyf1z1AccelDecel._f_accel_decel.<locals>._f.<locals>.f19   s    Q'1a400    c                 &    d d| z
            z
  S )Nr   r   )r   r   s    r   f2z1AccelDecel._f_accel_decel.<locals>._f.<locals>.f2<   s    22a!e99}$r   r   r   )r   r   r   r   s     @r   _fz%AccelDecel._f_accel_decel.<locals>._f8   se    1 1 1 1 1% % % % % Grr!uu$SBBqEE'999r   r   )selfr   old_durationr   r	   r
   r   r   s          @r   _f_accel_decelzAccelDecel._f_accel_decel3   sI     *	: 	: 	: 	: 	: bb!l"2x!?@@@@r   c                       j         j         _          j        dk     rt          d                               fd                               j                   S )zApply the effect to the clip.Nr   z%'sooness' should be a positive numberc                 `                         | j        j        j        j                  S )N)r   r   r   r	   r
   )r   durationr   r	   r
   )r   clipr   s    r   <lambda>z"AccelDecel.apply.<locals>.<lambda>L   s4    d))!]!.? *   r   )r   r   r
   
ValueErrortime_transformwith_duration)r   r   s   ``r   applyzAccelDecel.applyC   sv    $ $D=1DEEE""    
 
 -)
*
*	+r   )r   r   )__name__
__module____qualname____doc__r   float__annotations__r	   r
   r   r$   r   r   r   r   r      s         % %N L%JHe GJA A A A + + + + +r   r   N)dataclassesr   moviepy.Effectr   r   r   r   r   <module>r-      ss    ! ! ! ! ! ! ! ! ! ! ! ! L+ L+ L+ L+ L+ L+ L+ L+ L+ L+r   