Created
September 23, 2014 20:41
-
-
Save maluta/6a098278e869c7f9bae7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import numpy as np | |
import gizeh as gz | |
import moviepy.editor as mpy | |
W,H = 350, 100 | |
D = 3 # duration in seconds | |
r = 22 # size of the letters / pentagons | |
gradient= gz.ColorGradient("linear",((0,(0,.5,1)),(1,(1,1,1))), | |
xy1=(0,-r), xy2=(0,r)) | |
polygon = gz.regular_polygon(r, 5, stroke_width=3, fill=gradient) | |
def make_frame(t): | |
surface = gz.Surface(W+70,H, bg_color=(1,1,0)) | |
for i, letter in enumerate(u"PROGRAMAÊ!"): | |
angle = max(0,min(1,2*t/D-1.0*i/10))*2*np.pi | |
txt = gz.text(letter, "didact gothic", 3*r/2, fontweight='bold') | |
group = (gz.Group([polygon, txt]) | |
.rotate(angle) | |
.translate((W*(i+1)/9,H/2))) | |
group.draw(surface) | |
return surface.get_npimage() | |
clip = mpy.VideoClip(make_frame, duration=D) | |
clip.write_gif("gizeh.gif",fps=20, opt="OptimizePlus") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment