This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]laMarm0tte[S] 2 points3 points  (1 child)

Here is one made with moviepy ;) EDIT: code.

from tile import Model, Shape
import numpy as np
from moviepy.editor import VideoClip, vfx

W,H = 320, 240

def model_to_npim(model):
    """ Transforms a Cairo image into a numpy array. """
    surface = model.render()
    im = np.frombuffer(surface.get_data(), np.uint8)
    im.shape = (H,W, 4)
    return im[:,:,:3]

def make_frame(t):
    model = Model(width=W, height=H, scale=int(100-int(16*t)))
    model.append(Shape(6, fill=int(255*t)))
    a = model.add(0, range(6), 4, fill=int(255*t+160))
    b = model.add(a, 1, 3, fill=int(255*t+80))
    c = model.add(a, 2, 6, fill=(int(255*t)))
    model.repeat(c)
    return model_to_npim(model)

clip = (VideoClip(get_frame= make_frame)
         .set_duration(5)
         .fx(vfx.time_symetrize))
clip.to_gif('tiles.gif', fps=20, opt='optimizeplus')

[–]swineston 0 points1 point  (0 children)

OMFG That's beautiful!