问题描述
我怎样才能让文本继续而不停在左侧? 我没有看到我使用的方法有问题。而且我认为我为动画使用了正确的公式。
from moviepy.editor import *
# Load video
video = VideoFileClip("auto.mp4")
# Video lenght
duration = video.duration
# Video size
w,h = video.size
# Load text from txt
f = open('data.txt','r')
data = f.read().replace('\n','')
# Text for video
txt = (TextClip(data,fontsize=50,font='Amiri-regular',color='white')
.set_duration(duration))
# Transparent text background
txt_col = txt.on_color(size=(video.w + txt.w,txt.h - 10),color=(0,0),pos=(6,'center'),col_opacity=0.8)
# Animate text
txt_mov = txt_col.set_pos(lambda t: (max(w / w,int(w - 0.5 * w * t)),max(5.4 * h / 6,int(0 * t))))
# Overlay text on video
result = CompositeVideoClip([video,txt_mov])
# Render video
result.write_videofile("test.mp4")
解决方法
代码在我使用时对我有用
res.cookie("jwt",token,{
expires: new Date(
Date.now() + process.env.JWT_COOKIE_EXPIRES_IN * 24 * 60 * 60 * 1000
),httpOnly: true,// cannot be modified by the browser
});
代替
int(w - 0.5 * w * t)
所以 max(w/w,int(w - 0.5 * w * t))
正在停止动画