forked from Zulko/moviepy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogo.py
28 lines (19 loc) · 815 Bytes
/
logo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from moviepy.editor import *
import numpy as np
w,h = moviesize = (720,380)
duration = 1
def f(t,size, a = np.pi/3, thickness = 20):
w,h = size
v = thickness* np.array([np.cos(a),np.sin(a)])[::-1]
center = [int(t*w/duration),h/2]
return biGradientScreen(size,center,v,0.6,0.0)
logo = ImageClip("../../videos/logo_descr.png").\
resize(width=w/2).\
set_mask(mask)
screen = logo.on_color(moviesize, color = (0,0,0), pos='center')
shade = ColorClip(moviesize,col=(0,0,0))
mask_frame = lambda t : f(t,moviesize,duration)
shade.mask = VideoClip(ismask=True, get_frame = mask_frame)
cc = CompositeVideoClip([im.set_pos(2*["center"]),shade],
size = moviesize)
cc.subclip(0,duration).write_videofile("moviepy_logo.avi",fps=24)