import os import sys sys.path.append(os.path.abspath('.')) import metroani video = metroani.make_video(*metroani.settings_from_json('settings/gif.json')) gif_duration = (1 + 0.7 + 1 + 0.7 + 1) * 2 (video .subclip(0, gif_duration) .resize(0.5) .write_gif('examples/example.gif', fps=24)) os.system('gifsicle -O3 examples/example.gif -o examples/out.gif') os.system('rm examples/example.gif') os.system('mv examples/out.gif examples/example.gif')
local = [ metroani.StationTranslation(name='各駅停車', font='Hiragino Sans GB W3', fontsize=70, enter_xy=[960, 35], exit_xy=[960, 100], scale_x=1), metroani.StationTranslation(name='Local', font='Roboto', fontsize=60, enter_xy=[960, 35], exit_xy=[960, 100], scale_x=1) ] service_settings = metroani.Transition(local, [200, 70]) clip = metroani.make_video( constants, station_settings, terminal_settings, [next_settings], service_settings, ) # We can write the clip into a video file, but this file is just a demostration # of the python settings API # This setting file actually doesn't generate example.gif because only two # stations are given. Nevertheless, adding more stations is essentially # copy, paste, replace the name.
import os import sys sys.path.append(os.path.abspath('.')) import metroani video = metroani.make_video( *metroani.settings_from_json('settings/keihin.json')) gif_duration = (1 + 0.7 + 1 + 0.7 + 1) * 2 (video.subclip(0, gif_duration).resize(0.5) #.save_frame('output/keihin.png')) .write_gif('examples/keihin.gif', fps=24)) os.system('gifsicle -O3 examples/keihin.gif -o examples/out.gif') os.system('rm examples/keihin.gif') os.system('mv examples/out.gif examples/keihin.gif')