U
    a¨+dV  ã                   @   s|   d Z ddlmZmZ ddlmZ ddlmZ ddlmZ eedd„ ƒƒZ	eed	d
„ ƒƒZ
dd„ Zedd„ ƒZedd„ ƒZdS )z°
Here is the current catalogue. These are meant
to be used with clip.fx. There are available as transfx.crossfadein etc.
if you load them with ``from moviepy.editor import *``
é    )Úadd_mask_if_noneÚrequires_duration)Úfadein)Úfadeouté   )ÚCompositeVideoClipc                 C   s&   | j | j_ |  ¡ }| j t|¡|_|S )z‡ Makes the clip appear progressively, over ``duration`` seconds.
    Only works when the clip is included in a CompositeVideoClip.
    )ÚdurationÚmaskÚcopyÚfxr   ©Úclipr   Znewclip© r   úI/tmp/pip-unpacked-wheel-0yp4gafk/moviepy/video/compositing/transitions.pyÚcrossfadein   s    
r   c                 C   s&   | j | j_ |  ¡ }| j t|¡|_|S )zŠ Makes the clip disappear progressively, over ``duration`` seconds.
    Only works when the clip is included in a CompositeVideoClip.
    )r   r	   r
   r   r   r   r   r   r   Úcrossfadeout   s    
r   c                    sN   | j \‰‰‡ ‡fdd„‡ ‡fdd„‡ ‡fdd„‡ ‡fdd„dœ}|  || ¡S )aû   Makes the clip arrive from one side of the screen.

    Only works when the clip is included in a CompositeVideoClip,
    and if the clip has the same size as the whole composition.

    Parameters
    ===========

    clip
      A video clip.

    duration
      Time taken for the clip to be fully visible

    side
      Side of the screen where the clip comes from. One of
      'top' | 'bottom' | 'left' | 'right'

    Examples
    =========

    >>> from moviepy.editor import *
    >>> clips = [... make a list of clips]
    >>> slided_clips = [CompositeVideoClip([
                            clip.fx(transfx.slide_in, duration=1, side='left')])
                        for clip in clips]
    >>> final_clip = concatenate( slided_clips, padding=-1)

    c                    s   t dˆ| ˆ  d  ƒdfS ©Nr   r   Úcenter©Úmin©Út©r   Úwr   r   Ú<lambda>E   ó    zslide_in.<locals>.<lambda>c                    s   t dˆd| ˆ    ƒdfS r   ©Úmaxr   r   r   r   r   F   r   c                    s   dt dˆ| ˆ  d  ƒfS ©Nr   r   r   r   r   ©r   Úhr   r   r   G   r   c                    s   dt dˆd| ˆ    ƒfS r   r   r   r   r   r   r   H   r   ©ÚleftÚrightÚtopZbottom)ÚsizeÚset_position©r   r   ZsideZpos_dictr   )r   r    r   r   Úslide_in&   s    
ýr(   c                    s`   | j \‰‰| jˆ  ‰‡ ‡‡fdd„‡ ‡‡fdd„‡ ‡‡fdd„‡ ‡‡fdd„dœ}|  || ¡S )aõ   Makes the clip go away by one side of the screen.

    Only works when the clip is included in a CompositeVideoClip,
    and if the clip has the same size as the whole composition.

    Parameters
    ===========

    clip
      A video clip.

    duration
      Time taken for the clip to fully disappear.

    side
      Side of the screen where the clip goes. One of
      'top' | 'bottom' | 'left' | 'right'

    Examples
    =========

    >>> from moviepy.editor import *
    >>> clips = [... make a list of clips]
    >>> slided_clips = [CompositeVideoClip([
                            clip.fx(transfx.slide_out, duration=1, side='left')])
                        for clip in clips]
    >>> final_clip = concatenate( slided_clips, padding=-1)

    c                    s   t dˆ| ˆ  ˆ   ƒdfS ©Nr   r   r   r   ©r   Útsr   r   r   r   o   r   zslide_out.<locals>.<lambda>c                    s   t dˆ| ˆ ˆ   ƒdfS r)   r   r   r*   r   r   r   p   r   c                    s   dt dˆ| ˆ  ˆ   ƒfS ©Nr   r   r   r   ©r   r    r+   r   r   r   q   r   c                    s   dt dˆ| ˆ ˆ   ƒfS r,   r   r   r-   r   r   r   r   r   r!   )r%   r   r&   r'   r   )r   r    r+   r   r   Ú	slide_outM   s     

ýr.   c                 C   s0   | j }|  t|¡ || ¡}t| |gƒ ||¡S )zœ Makes the clip fade in progressively at its own end, this way
    it can be looped indefinitely. ``cross`` is the duration in seconds
    of the fade-in.  )r   r   r   Z	set_startr   Zsubclip)r   Zcross_durationÚdZclip2r   r   r   Úmake_loopablew   s    r0   N)Ú__doc__Zmoviepy.decoratorsr   r   Zmoviepy.video.fx.fadeinr   Zmoviepy.video.fx.fadeoutr   r   r   r   r(   r.   r0   r   r   r   r   Ú<module>   s   

'
)