Skip to content

Commit

Permalink
Remove 'make_loopable' from transitions (Zulko#1477)
Browse files Browse the repository at this point in the history
* Remove 'make_loopable' from transitions

* Add CHANGELOG entry

* Remove unused import

* Change argument name
  • Loading branch information
mondeja committed Jan 22, 2021
1 parent b576403 commit 22037d9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `video_nframes` attribute of dictionary returned from `ffmpeg_parse_infos` renamed to `video_n_frames` [\#1471](https://github.com/Zulko/moviepy/pull/1471)
- Renamed `colorx` FX by `multiply_color` [\#1475](https://github.com/Zulko/moviepy/pull/1475)
- Renamed `speedx` FX by `multiply_speed` [\#1478](https://github.com/Zulko/moviepy/pull/1478)
- `make_loopable` transition must be used as FX [\#1477](https://github.com/Zulko/moviepy/pull/1477)

### Deprecated <!-- for soon-to-be removed features -->
- `moviepy.video.fx.all` and `moviepy.audio.fx.all`. Use the fx method directly from the clip instance or import the fx function from `moviepy.video.fx` and `moviepy.audio.fx`. [\#1105](https://github.com/Zulko/moviepy/pull/1105)
Expand Down
14 changes: 1 addition & 13 deletions moviepy/video/compositing/transitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
"""

from moviepy.decorators import add_mask_if_none, requires_duration
from moviepy.video.compositing.CompositeVideoClip import CompositeVideoClip
from moviepy.video.fx.fadein import fadein
from moviepy.video.fx.fadeout import fadeout


__all__ = ["crossfadein", "crossfadeout", "slide_in", "slide_out", "make_loopable"]
__all__ = ["crossfadein", "crossfadeout", "slide_in", "slide_out"]


@requires_duration
Expand Down Expand Up @@ -119,14 +118,3 @@ def slide_out(clip, duration, side):
}

return clip.with_position(pos_dict[side])


@requires_duration
def make_loopable(clip, overlap_duration):
"""Makes the clip fade in progressively at its own end, this way
it can be looped indefinitely. ``overlap_duration`` is the duration in seconds
of the fade-in."""
clip2 = clip.fx(crossfadein, overlap_duration).with_start(
clip.duration - overlap_duration
)
return CompositeVideoClip([clip, clip2]).subclip(overlap_duration, clip.duration)
19 changes: 12 additions & 7 deletions moviepy/video/fx/make_loopable.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@


@requires_duration
def make_loopable(clip, overlap_time):
def make_loopable(clip, overlap_duration):
"""Makes the clip fade in progressively at its own end, this way it can be
looped indefinitely.
Parameters
----------
overlap_duration : float
Duration of the fade-in (in seconds).
"""
Makes the clip fade in progressively at its own end, this way
it can be looped indefinitely. ``overlap_time`` is the duration in seconds
of the fade-in."""
clip2 = clip.fx(transfx.crossfadein, overlap_time).with_start(
clip.duration - overlap_time
clip2 = clip.fx(transfx.crossfadein, overlap_duration).with_start(
clip.duration - overlap_duration
)
return CompositeVideoClip([clip, clip2]).subclip(overlap_time, clip.duration)
return CompositeVideoClip([clip, clip2]).subclip(overlap_duration, clip.duration)

0 comments on commit 22037d9

Please sign in to comment.