创建文本动画
学习如何创建文本动画效果
创建文本动画
本教程将指导你从头开始创建一个文本动画视频。
你将创建什么
一个 5 秒的视频,包含动画文本:
- 平滑淡入
- 从下方滑入
- 带有阴影效果
完整 Schema
{
"meta": {
"version": "2.0.0",
"title": "文本动画示例"
},
"video": {
"width": 1920,
"height": 1080,
"fps": 30,
"duration": 5,
"background": "#1a1a2e"
},
"tracks": [
{
"id": "main",
"type": "visual",
"clips": [
{
"id": "title",
"type": "text",
"text": "欢迎",
"start": 0,
"duration": 5,
"transform": {
"x": "50%",
"y": "50%",
"anchor": "center"
},
"style": {
"fontSize": 96,
"fontWeight": 700,
"fill": "#ffffff",
"shadowColor": "#000000",
"shadowBlur": 20
},
"animations": [
{ "type": "fadeIn", "duration": 1 },
{ "type": "slideIn", "direction": "up", "duration": 1 }
]
}
]
}
]
}逐步分解
1. 设置视频属性
首先定义视频尺寸和时长:
{
"video": {
"width": 1920,
"height": 1080,
"fps": 30,
"duration": 5,
"background": "#1a1a2e"
}
}- 1920x1080:标准 1080p 分辨率
- 30 fps:标准帧率
- 5 秒:短动画
- #1a1a2e:深蓝色背景
2. 创建轨道
添加视觉轨道来放置文本:
{
"tracks": [
{
"id": "main",
"type": "visual",
"clips": []
}
]
}3. 添加文本片段
创建带有基本属性的文本片段:
{
"id": "title",
"type": "text",
"text": "欢迎",
"start": 0,
"duration": 5
}4. 定位文本
使用变换将文本居中:
{
"transform": {
"x": "50%",
"y": "50%",
"anchor": "center"
}
}使用百分比可以使位置自适应视频大小。
5. 设置文本样式
添加视觉样式:
{
"style": {
"fontSize": 96,
"fontWeight": 700,
"fill": "#ffffff",
"shadowColor": "#000000",
"shadowBlur": 20
}
}- fontSize: 96:大号醒目文本
- fontWeight: 700:粗体
- fill: #ffffff:白色
- shadowColor/Blur:添加阴影深度
6. 添加动画
让文本动起来:
{
"animations": [
{ "type": "fadeIn", "duration": 1 },
{ "type": "slideIn", "direction": "up", "duration": 1 }
]
}多个动画同时运行,产生组合效果。
变体
弹跳效果
添加弹跳缓动,更有个性:
{
"animations": [
{
"type": "zoomIn",
"duration": 0.8,
"easing": "easeOutBack"
}
]
}交错文本
创建多个带有延迟动画的文本片段:
{
"clips": [
{
"type": "text",
"text": "你好",
"start": 0,
"duration": 3,
"animations": [{ "type": "fadeIn", "duration": 0.5 }]
},
{
"type": "text",
"text": "世界",
"start": 0.5,
"duration": 2.5,
"animations": [{ "type": "fadeIn", "duration": 0.5 }]
}
]
}动手试试
- 复制上面的完整 Schema
- 进入 编辑器
- 切换到 JSON 模式
- 粘贴并修改数值
- 下载你的 Schema