
    W|h	                     <    S SK Jr  S SKJr  \ " S S\5      5       rg)    )	dataclass)Effectc                   V    \ rS rSr% SrSr\\S'   Sr\\S'   Sr	\\S'    SS jr
S	 rS
rg)
AccelDecel   a  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                 8   ^ SU-   mU4S jnX&" X-  U-  5      -  $ )Nr	   c                 X   >^ U4S jmU4S jnU S:  T" U 5      -  U S:  U" U 5      -  -   $ )Nc                     > SST-
  -  U T-  -  $ )N      ?    )tas    U/home/james-whalen/.local/lib/python3.13/site-packages/moviepy/video/fx/AccelDecel.pyf11AccelDecel._f_accel_decel.<locals>._f.<locals>.f19   s    Q'1a400    c                     > ST" SU -
  5      -
  $ )Nr   r   )r   r   s    r   f21AccelDecel._f_accel_decel.<locals>._f.<locals>.f2<   s    2a!e9}$r   r   r   )r   r   r   r   s     @r   _f%AccelDecel._f_accel_decel.<locals>._f8   s4    1% Gr!u$SBqE'999r   r   )selfr   old_durationr   r
   r   r   r   s          @r   _f_accel_decelAccelDecel._f_accel_decel3   s.     *	: b!"2x!?@@@r   c                    ^ ^ T R                   c  TR                  T l         T R                  S:  a  [        S5      eTR	                  UU 4S j5      R                  T R                   5      $ )zApply the effect to the clip.r   z%'sooness' should be a positive numberc                 z   > TR                  U TR                  TR                  TR                  TR                  S9$ )N)r   r   r   r
   r   )r   durationr   r
   r   )r   clipr   s    r   <lambda>"AccelDecel.apply.<locals>.<lambda>L   s6    d))!]]!..?? * r   )r   r#   r   
ValueErrortime_transformwith_duration)r   r$   s   ``r   applyAccelDecel.applyC   s]    $ $D==1DEE""
 -))
*	+r   )r   )r	   r	   )__name__
__module____qualname____firstlineno____doc__r   float__annotations__r
   r   r   r*   __static_attributes__r   r   r   r   r      s:    %N L%JHe GJA +r   r   N)dataclassesr   moviepy.Effectr   r   r   r   r   <module>r6      s)    ! ! L+ L+ L+r   