MediaMaker 1.0.6

dotnet add package MediaMaker --version 1.0.6
                    
NuGet\Install-Package MediaMaker -Version 1.0.6
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MediaMaker" Version="1.0.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MediaMaker" Version="1.0.6" />
                    
Directory.Packages.props
<PackageReference Include="MediaMaker" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MediaMaker --version 1.0.6
                    
#r "nuget: MediaMaker, 1.0.6"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=MediaMaker&version=1.0.6
                    
Install MediaMaker as a Cake Addin
#tool nuget:?package=MediaMaker&version=1.0.6
                    
Install MediaMaker as a Cake Tool

使用示例代码

using MediaMaker;
using System.Drawing;
using System.Net;

//获取视频信息
var file = @"D:\Tencent\WeMeet\3.17.5.403\resources\raw\ringing_short.mp3";
var info1 = !File.Exists(file) ? (-1, -1, -1) : VideoMaker.MediaInfo(file);
file = @"C:\Users\葛杰\28679\MediaTest\MediaTest\bin\Debug\net6.0\video.mp4";
var info2 = !File.Exists(file) ? (-1, -1, -1) : VideoMaker.MediaInfo(file, file + ".png");
//获取字体信息
var fonts = VideoMaker.Fonts;

//定义模板
var template = new Template();
#region 添加图层
template.Pieces.Add(new PieceColor() { Width = 880, Height = 660, X = "150", Y = "100", Color = ColorTranslator.ToHtml(Color.Red) });

template.Pieces.Add(new PieceVideo() { Width = 1080 / 2, Height = 1920 / 2, X = "50", Y = "50", Url = @"E:\DATA\Resource\0\1_7401864882821369129_media_00.mp4", Alpha = 60, BoxBlur_LR = 2, BoxBlur_LP = 2, Hflip = true, Vflip = true, CropX = 500, CropY = 1000, CropWidth = 400, CropHeight = 800, Rotate = 20, CutOffset = 9, Offset = 7, Duration = 2, Volume = 10, InstanceID = "视频", });
template.Pieces.Add(new PieceImage() { Width = 800, Height = 600, X = "50", Y = "50", Alpha = 40, Url = @"C:\Users\28679\Desktop\data\Article\UploadFiles\202202\W020220215577858189643.jpg", InstanceID = "背景图片", Offset = 1f, Duration = 2, Effects = new List<IPieceEffect> { new Effect_FlyIn { Direction = FlyDirection.Up }, new Effect_FlyOut { Direction = FlyDirection.Down }, new Effect_FadeIn { Duration = 3 }, new Effect_FadeOut { Duration = 3 }, } });
//template.Pieces.Add(new PieceImage() { X = "20", Y = "0", Alpha = 40, Url = "1.gif", Offset = 7.5f, Duration = 15, Hflip = true, Vflip = true, BoxBlur_LR = 2, BoxBlur_LP = 2, Rotate = 45, CropX = 400, CropY = 200, CropWidth = 400, CropHeight = 200, Width = 300, Height = 250, InstanceID = "图片", });
template.Pieces.Add(new PieceColor() { Width = 600, Height = 200, X = "50", Y = "50", Alpha = 80, Color = ColorTranslator.ToHtml(Color.Green), Offset = 15, Duration = 12, BorderColor = ColorTranslator.ToHtml(Color.DarkGreen), BorderWidth = 2, InstanceID = "色块", });

template.Pieces.Add(new PieceText() { Width = 200, Height = 400, X = "200", Y = "400", Alpha = 100, Content = "深知每个人的生活需求都是独特的,因此生成模型注重用户体验和个性化定制.您可以根据自己的喜好和需求,自定义设置豆包的功能和界面,让它更符合您的个人风格", ForeColor = ColorTranslator.ToHtml(Color.OrangeRed), FontSize = 44, FontName = "幼圆", BackColor = ColorTranslator.ToHtml(Color.DarkRed), FontStyle = FontStyle.Underline, Offset = 3, Duration = 2, ShadowX = 5, ShadowY = 10, ShadowColor = ColorTranslator.ToHtml(Color.Green), BorderColor = ColorTranslator.ToHtml(Color.White), BorderWidth = 1, TextAlign = 10, BackWidth = 0, FontAlign = 1, LineSpacing = 0, InstanceID = "文字" });
template.Pieces.Add(new PieceAudio() { Url = @"D:\Tencent\WeMeet\3.16.3.425\resources\raw\ringing_short.mp3", Volume = 20, CutOffset = 1, Offset = 3, Duration = 2, InstanceID = "音频", Loop = -1 });
template.Pieces.Add(new PieceHtml() { X = "200", Y = "0", Alpha = 40, Url = "PieceHtml/index.html", Hflip = true, Vflip = true, BoxBlur_LR = 2, BoxBlur_LP = 2, Rotate = 45, CropX = 20, CropY = 10, CropWidth = 300, CropHeight = 500, Width = 300, Height = 250, InstanceID = "HTML", MethodName = "setrealtime", /*DataJson= "[{name: '站名',area: '大连',value: 35.9,unit: '℃',}]", OptionsJson= "{sort: 'dsc',key: 'value'}" */});
template.Pieces.Add(new PieceHtml() { X = "0", Y = "200", Alpha = 80, Url = "PieceHtml/index.html", Width = 300, Height = 250, InstanceID = "HTML", ApiUrl = "/api/test/dddd", MethodName = "setranking", DataJson = "[{name: '站名',area: '大连',value: 35.9,unit: '℃',}]", OptionsJson = "{sort: 'dsc',key: 'value'}" });
template.Pieces.Add(new PieceHtml() { X = "0", Y = "0", Alpha = 100, Url = "PieceHtml/index.html", Width = 300, Height = 300, InstanceID = "HTML", ApiUrl = "/api/test/dddd", MethodName = "serecharts", DataJson = null, OptionsJson = "{gifWidth: 300,gifHeight: 300}" });
template.Pieces.Add(new PieceGroup() { X = "600", Y = "600", Alpha = 100, Width = 600, Height = 600, TemplateID = "123", Offset = 1, Duration = 10, InstanceID = "Group", });
#endregion

//JSON解析与反解析
var jsonPath = @"C:\Users\28679\Desktop\合成杂音.json";
var baseUrl = "http://116.255.241.135:19002/static/";
if (File.Exists(jsonPath))
{
    template = Template.FromJson(File.ReadAllText(jsonPath));
    foreach (var p in template.Pieces)
    {
        var url = string.Empty;
        if (p is PieceImage image) url = image.Url;
        if (p is PieceVideo video) url = video.Url;
        if (p is PieceAudio audio) url = audio.Url;
        if (string.IsNullOrWhiteSpace(url)) continue;
        Console.WriteLine("下载文件:" + url);
        var f = new FileInfo(url);
        if (f.Exists) continue;
        if (!f.Directory.Exists) f.Directory.Create();
        new WebClient().DownloadFile(new Uri(new Uri(baseUrl), url), url);
    }
    Console.WriteLine("文件缓存完成");
}
var json = template.ToJson();

//应用模板并生成
var o = VideoMaker.Init()
    .BatchPower(10)
    .RootPath(string.Empty)
    .SetReadTemplateFun(async id =>
    {
        //1、从数据库中读取模板内容为文本
        //2、在此方法中需要对模板里的气象标签等变量进行处理
        //if (json.Contains("$")) json = json.ApplyLabel();
        //3、反序列化返回实体类

        //以下为测试代码
        var t = Template.FromJson(json);
        t.Pieces.RemoveAll(d => d.Type == 9);
        return t;
    })
    .ApplyTemplate(template)
    .Output("test.mp4")
    .Render(p => { Console.WriteLine($"已完成{p}%..."); return true; });
Console.WriteLine(o.Arguments);

#模板定义 模板中定义的层共分为7种,分别是: 颜色0/文本1/图片2/音频3/视频4/HTML5/字幕6/组件9

HTML类型的层,可参看nuget包内的PieceHtml文件夹下的示例文件。

/*此文件为视频生成组件所使用的配置文件示例*/
{
  //配置文件模板ID,可不填
  "ID": 0,
  //模板种类:0普通模板,1组件模板
  "Type": 0,
  //总时长。-1表示不限制
  "Duration": -1,
  //块配置,数组中自上而下为每个元素层,类似于PS中的图层,按索引越大越在上层
  "Pieces": [
    //色块图层:Type=0
    {
      /*层通用配置*/
      //所属组件实例ID,可手动命名
      "InstanceID": "色块",
      //类型颜色0/文本1/图片2/音频3/视频4/HTML5/字幕6/组件9,类型必须匹配
      "Type": 0,
      //X,距离左上角
      "X": "150",
      //Y,距离左上角
      "Y": "100",
      //宽
      "Width": 880,
      //高
      "Height": 660,
      //整体透明度
      "Alpha": 100,
      //时长偏移,默认不偏移,偏移只计算正向
      "Offset": 0,
      //时长,默认-1不考虑时长
      "Duration": -1,
      /*以下为该类型层独有的配置*/
      //底色,默认透明
      "Color": "Red",
      //边框颜色,默认透明
      "BorderColor": "Transparent",
      //边框宽度,默认0
      "BorderWidth": 0,
      //边框圆角半径,默认无。不建议使用(影响性能)
      // 设置原则:上右下左(英文逗号分割),如20,20,0,10;或统一设置,如20。
      "Round": ""
    },
    //视频图层:Type=4
    {
      /*层通用配置*/
      //所属组件实例ID,可手动命名
      "InstanceID": "视频",
      //类型颜色0/文本1/图片2/音频3/视频4/HTML5/字幕6/组件9,类型必须匹配
      "Type": 4,
      //X,距离左上角
      "X": "50",
      //Y,距离左上角
      "Y": "50",
      //宽
      "Width": 540,
      //高
      "Height": 960,
      //整体透明度
      "Alpha": 60,
      //时长偏移,默认不偏移,偏移只计算正向
      "Offset": 7,
      //时长,默认-1不考虑时长
      "Duration": 2,
      /*以下为该类型层独有的配置*/
      //文件路径,支持在线路径
      "Url": "E:\\DATA\\Resource\\0\\1_7401864882821369129_media_00.mp4",
      //裁剪左上角X
      "CropX": 500,
      //裁剪左上角Y
      "CropY": 1000,
      //裁剪宽度
      "CropWidth": 400,
      //裁剪高度
      "CropHeight": 800,
      //模糊半径
      "BoxBlur_LR": 2,
      //模糊次数
      "BoxBlur_LP": 2,
      //顺时针旋转角度
      "Rotate": 20,
      //水平反转
      "Hflip": true,
      //垂直反转
      "Vflip": true,
      //视频文件截取开始时间
      "CutOffset": 9,
      //视频文件截取时长
      "CutDuration": -1,
      //音量,默认100
      "Volume": 10,
      //循环次数:-1无限循环、0不循环、n循环次数
      "Loop": 0,
      //抠图颜色,默认为空表示不抠图
      "ChromaKeyColor": null,
      //抠图容差,默认0.01,最大1。
      "ChromaKeySimilarity": 0.01
    },
    //图片图层:Type=2
    {
      /*层通用配置*/
      //所属组件实例ID,可手动命名
      "InstanceID": "图片",
      //类型颜色0/文本1/图片2/音频3/视频4/HTML5/字幕6/组件9,类型必须匹配
      "Type": 2,
      //X,距离左上角
      "X": "50",
      //Y,距离左上角
      "Y": "50",
      //宽
      "Width": 800,
      //高
      "Height": 600,
      //整体透明度
      "Alpha": 40,
      //时长偏移,默认不偏移,偏移只计算正向
      "Offset": 1,
      //时长,默认-1不考虑时长
      "Duration": 2,
      /*以下为该类型层独有的配置*/
      //文件路径或BASE64,支持在线路径
      "Url": "C:\\Users\\葛杰\\Desktop\\data\\Article\\UploadFiles\\202202\\W020220215577858189643.jpg",
      //裁剪左上角X
      "CropX": 0,
      //裁剪左上角Y
      "CropY": 0,
      //裁剪宽度
      "CropWidth": 0,
      //裁剪高度
      "CropHeight": 0,
      //模糊半径
      "BoxBlur_LR": 0,
      //模糊次数
      "BoxBlur_LP": 0,
      //顺时针旋转角度
      "Rotate": 0,
      //水平反转
      "Hflip": false,
      //垂直反转
      "Vflip": false,
      //效果,目前支持图片图层及视频图层,可多个
      "Effects": [
        {
          //效果名称:飞入
          "Name": "FlyIn",
          //效果时长
          "Duration": 0.5,
          //独有属性:飞入方向,支持Up\Down\Left\Right
          "Direction": "Up"
        },
        {
          "Duration": 0.5,
          "Direction": "Down",
          "Name": "FlyOut"
        },
        {
          "Duration": 3,
          "Name": "FadeIn"
        },
        {
          "Duration": 3,
          "Name": "FadeOut"
        },
        {
          // 强调开始时间,以图层开始时间为起点,默认0
          "Offset": 0,
          "Duration": 3,
          //强调类型,默认颤抖,支持ChanDou、TanHuang、TanRu、TiaoDong、YaoBai、YaoHuang、YuShuaLeft、YuShuaRight
          //分别代表颤抖、弹簧、弹入、跳动、摇摆、摇晃、雨刷左、雨刷右
          "Type": "",
          "Name": "EM"
        }
      ]
    },
    {
      "Type": 0,
      "Color": "Green",
      "BorderColor": "DarkGreen",
      "BorderWidth": 2,
      "InstanceID": "色块",
      "X": "50",
      "Y": "50",
      "Width": 600,
      "Height": 200,
      "Alpha": 80,
      "Offset": 15,
      "Duration": 12
    },
    //文字图层:Type=1
    {
      /*层通用配置*/
      //所属组件实例ID,可手动命名
      "InstanceID": "文字",
      //类型颜色0/文本1/图片2/音频3/视频4/HTML5/字幕6/组件9,类型必须匹配
      "Type": 1,
      //X,距离左上角
      "X": "200",
      //Y,距离左上角
      "Y": "400",
      //宽
      "Width": 200,
      //高
      "Height": 400,
      //整体透明度
      "Alpha": 30,
      //时长偏移,默认不偏移,偏移只计算正向
      "Offset": 3,
      //时长,默认-1不考虑时长
      "Duration": 2,
      /*以下为该类型层独有的配置*/
      //底色,默认透明
      "BackColor": "DarkRed",
      //底色外扩宽度,默认0
      "BackWidth": 0,
      //字色,默认黑色
      "ForeColor": "OrangeRed",
      //文本内容
      "Content": "深知每个人的生活需求都是独特的,因此生成模型注重用户体验和个性化定制.您可以根据自己的喜好和需求,自定义设置豆包的功能和界面,让它更符合您的个人风格",
      //字体名或字体文件名,默认仿宋
      "FontName": "幼圆",
      //字体大小,默认16
      "FontSize": 22,
      //字体样式,暂不支持
      "FontStyle": 4,
      //文字包边/衬底宽度,默认为0
      "BorderWidth": 1,
      //文字包边/衬底颜色,默认透明
      "BorderColor": "White",
      //阴影偏移X,默认为0
      "ShadowX": 5,
      //阴影偏移Y,默认为0
      "ShadowY": 10,
      //阴影颜色,默认透明
      "ShadowColor": "Green",
      //文字布局:文字布局,LEFT = 1,RIGHT = 2,TOP = 4,BOTTOM = 8, CENTER = 3,MIDDLE = 12;默认-1
      "TextAlign": 10,
      //行间距,默认为0
      "LineSpacing": 0,
      //文字基线,0 text,1 baseline,2 font,默认-1
      "FontAlign": 1,
      // 文字换行模式,默认Standard。
      // 0=Standard:【单词保持】默认行中断规则;
      // 1=BreakAll:【中英文都截断】在任何两个字符间插入中断;
      // 2=KeepAll:【中英文都保持,会溢出】中日韩不使用单词中断,其他与Standard相同;
      // 3=BreakWord:【英文保持中文截断】按顺序使用Standard和BreakAll规则组合。
      "WordBreak": 0,
    },
    //音频图层:Type=3
    {
      /*层通用配置*/
      //所属组件实例ID,可手动命名
      "InstanceID": "音频",
      //类型颜色0/文本1/图片2/音频3/视频4/HTML5/字幕6/组件9,类型必须匹配
      "Type": 3,
      //X,距离左上角
      "X": "0",
      //Y,距离左上角
      "Y": "0",
      //宽
      "Width": 0,
      //高
      "Height": 0,
      //整体透明度
      "Alpha": 100,
      //时长偏移,默认不偏移,偏移只计算正向
      "Offset": 3,
      //时长,默认-1不考虑时长
      "Duration": 2,
      /*以下为该类型层独有的配置*/
      //文件路径,支持在线路径
      "Url": "D:\\Tencent\\WeMeet\\3.16.3.425\\resources\\raw\\ringing_short.mp3",
      //音频文件截取开始时间
      "CutOffset": 1,
      //音频文件截取时长
      "CutDuration": -1,
      //音量,默认100
      "Volume": 20,
      //循环次数:-1无限循环、0不循环、n循环次数,默认不循环
      "Loop": -1
    },
    //HTML图层:Type=5
    {
      /*层通用配置*/
      //所属组件实例ID,可手动命名
      "InstanceID": "HTML",
      //类型颜色0/文本1/图片2/音频3/视频4/HTML5/字幕6/组件9,类型必须匹配
      "Type": 5,
      //X,距离左上角
      "X": "200",
      //Y,距离左上角
      "Y": "0",
      //宽
      "Width": 300,
      //高
      "Height": 250,
      //整体透明度
      "Alpha": 40,
      //时长偏移,默认不偏移,偏移只计算正向
      "Offset": 0,
      //时长,默认-1不考虑时长
      "Duration": -1,
      /*以下为该类型继承图片层独有的配置*/
      //文件路径或BASE64,支持在线路径
      //"Url": "PieceHtml/index.html",
      //裁剪左上角X
      "CropX": 20,
      //裁剪左上角Y
      "CropY": 10,
      //裁剪宽度
      "CropWidth": 300,
      //裁剪高度
      "CropHeight": 500,
      //模糊半径
      "BoxBlur_LR": 2,
      //模糊次数
      "BoxBlur_LP": 2,
      //顺时针旋转角度
      "Rotate": 45,
      //水平反转
      "Hflip": true,
      //垂直反转
      "Vflip": true,
      /*以下为该类型层独有的配置*/
      //HTML脚本文件地址
      "Url": "PieceHtml/index.html",
      //需要访问API的主机域名,如http://10.86.24.80
      "ApiHost": null,
      //需要访问API的地址,如:/api/Check
      "ApiUrl": null,
      //获取图片base64的JS方法
      "MethodName": "setrealtime",
      //需要传送的配置json
      "OptionsJson": null,
      //需要传送的数据
      "DataJson": null
    },
    {
      "Type": 5,
      "ApiHost": null,
      "ApiUrl": "/api/test/dddd",
      "MethodName": "setranking",
      "OptionsJson": "{sort: 'dsc',key: 'value'}",
      "DataJson": "[{name: '站名',area: '大连',value: 35.9,unit: '℃',}]",
      "Url": "PieceHtml/index.html",
      "CropX": 0,
      "CropY": 0,
      "CropWidth": 0,
      "CropHeight": 0,
      "BoxBlur_LR": 0,
      "BoxBlur_LP": 0,
      "Rotate": 0,
      "Hflip": false,
      "Vflip": false,
      "InstanceID": "HTML",
      "X": "0",
      "Y": "200",
      "Width": 300,
      "Height": 250,
      "Alpha": 80,
      "Offset": 0,
      "Duration": -1
    },
    {
      "Type": 5,
      "ApiHost": null,
      "ApiUrl": "/api/test/dddd",
      "MethodName": "serecharts",
      "OptionsJson": "{gifWidth: 300,gifHeight: 300}",
      "DataJson": null,
      "Url": "PieceHtml/index.html",
      "CropX": 0,
      "CropY": 0,
      "CropWidth": 0,
      "CropHeight": 0,
      "BoxBlur_LR": 0,
      "BoxBlur_LP": 0,
      "Rotate": 0,
      "Hflip": false,
      "Vflip": false,
      "InstanceID": "HTML",
      "X": "0",
      "Y": "0",
      "Width": 300,
      "Height": 300,
      "Alpha": 100,
      "Offset": 0,
      "Duration": -1
    },
    //字幕图层:Type=6
    {
      /*层通用配置*/
      //所属组件实例ID,可手动命名
      "InstanceID": "字幕",
      //类型颜色0/文本1/图片2/音频3/视频4/HTML5/字幕6/组件9,类型必须匹配
      "Type": 6,
      //X,距离左上角
      //注意,该层此属性无用
      "X": "0",
      //Y,距离左上角
      //注意,该层此属性无用
      "Y": "0",
      //宽,默认为-1,表示不限制/缩放
      //注意,该层此属性作为字幕应用范围,一般为视频宽度
      "Width": 300,
      //高,默认为-1,表示不限制/缩放
      //注意,该层此属性作为字幕应用范围,一般为视频高度
      "Height": 300,
      //整体透明度
      "Alpha": 90,
      //时长偏移,默认不偏移,偏移只计算正向
      //注意,该层此属性无用
      "Offset": 1,
      //时长,默认-1不考虑时长
      //注意,该层此属性无用
      "Duration": 3,
      /*以下为该类型层独有的配置*/
        //字幕文件路径,支持在线路径,支持SRT/ASS/SSA格式字幕文件,支持ASS字幕文本内容的base64串(以data:text/plain;base64,开头)
        "Url": "1.srt",
        //字幕配置名称,仅ASS/SSA有效
        "ConfigName": "",
        //字体名称
        "Fontname": "",
        //粗体,仅Fontname有值时生效。
        "Bold": false,
        //斜体,仅Fontname有值时生效。
        "Italic": false,
        //下划线,仅Fontname有值时生效。
        "Underline": false,
        //删除线,仅Fontname有值时生效。
        "Strikeout": false,
        //字体大小
        "Fontsize": 12,
        //主色,字体颜色
        "PrimaryColour": "Green",
        //副色,一般为防撞色颜色
        "SecondaryColour": "Yellow",
        //边框颜色
        "OutlineColour": "Blue",
        //阴影或其他颜色
        "BackColour": "Red",
        //字幕X轴缩放比例
        "ScaleX": -1,
        //字幕Y轴缩放比例
        "ScaleY": -1,
        //字母间距
        "Spacing": -1,
        //字幕旋转角度(正数),
        "Angle": 0,
        //边框样式。1轮廓+投影,3不透明框
        "BorderStyle": 0,
        //当 BorderStyle 为 1 时,指定文本周围轮廓的宽度,以像素为单位。可取值为 0、1、2、3 或 4。
        "Outline": 0,
        //当 BorderStyle 为 1 时,指定文本后面的阴影深度,以像素为单位。可取值为 0、1、2、3 或 4。
        "Shadow": 0,
        //字幕对齐方式,取值1~9,按照数字键盘的方式排列。0对应下中;1、2、3对应下左、下中、下右;4/5、6、7对应上左、上中、上右;8/9、10、11对应中左、中间、中右。
        "Alignment": 0,
        //左边距,字幕到屏幕左边缘的距离。三个边距(MarginL, MarginR, MarginV)定义了显示字幕文本的区域。
        "MarginL": 0,
        //右边距,字幕到屏幕右边缘的距离。三个边距(MarginL, MarginR, MarginV)定义了显示字幕文本的区域。
        "MarginR": 0,
        // 字幕到屏幕顶部或底部的距离。
        // 如Alignment选择的是0123,MarginV就是字幕到屏幕底部的距离。
        // 如Alignment选择的是4567,MarginV就是字幕到屏幕顶部的距离。
        // 如Alignment选择的是891011,则MarginV无效,字幕会自动垂直居中。
        "MarginV": 0,
        //字幕文件字符编码格式
        "Encoding": null,
        //其他自定义的样式键值对,一般不需要
        "OtherStyle": {},
    },
    //组件图层:Type=9
    {
      /*层通用配置*/
      //所属组件实例ID,可手动命名
      "InstanceID": "组件",
      //类型颜色0/文本1/图片2/音频3/视频4/HTML5/字幕6/组件9,类型必须匹配
      "Type": 9,
      //X,距离左上角
      "X": "0",
      //Y,距离左上角
      "Y": "0",
      //宽,默认为-1,表示不限制/缩放
      "Width": 300,
      //高,默认为-1,表示不限制/缩放
      "Height": 300,
      //整体透明度
      "Alpha": 90,
      //时长偏移,默认不偏移,偏移只计算正向
      "Offset": 1,
      //时长,默认-1不考虑时长
      "Duration": 3,
      /*以下为该类型层独有的配置*/
      //所属组件ID
      "TemplateID": "1"
    }
  ]
}

各图形中可用Effect效果

飞入、飞出

{
    //效果名称:飞入
    "Name": "FlyIn",
    //效果时长
    "Duration": 0.5,
    //独有属性:飞入方向,支持Up\Down\Left\Right
    "Direction": "Up"
},
{
    //效果名称:飞出
    "Name": "FlyOut",
    //效果时长
    "Duration": 0.5,
    //独有属性:飞出方向,支持Up\Down\Left\Right
    "Direction": "Down"
},

淡入、淡出

{
    //效果名称:淡入
    "Name": "FadeIn",
    //效果时长
    "Duration": 3,
},
{
    //效果名称:淡出
    "Name": "FadeOut"
    //效果时长
    "Duration": 3,
},

强调

{
    //效果名称:强调
    "Name": "EM",
    //效果时长
    "Duration": 3,
    // 效果开始时间,以图层开始时间为起点,默认0
    "Offset": 0,
    //强调类型,默认颤抖,支持ChanDou、TanHuang、TanRu、TiaoDong、YaoBai、YaoHuang、YuShuaLeft、YuShuaRight
    //分别代表颤抖、弹簧、弹入、跳动、摇摆、摇晃、雨刷左、雨刷右
    "Type": "",
},

移动、缩放

{
    //效果名称:移动
    "Name": "Move",
    //效果时长
    "Duration": 3,
    // 效果开始时间,以图层开始时间为起点,默认0
    "Offset": 0,
    //结束坐标X
    "X": 0f,
    //结束坐标Y
    "Y": 0f,
},
{
    //效果名称:缩放
    "Name": "Scale",
    //效果时长
    "Duration": 3,
    // 效果开始时间,以图层开始时间为起点,默认0
    "Offset": 0,
    //结束宽度
    "Width": 0f,
    //结束高度
    "Height": 0f,
},

透视变形

该效果比较特殊,需要按以下规则使用

  • 透视效果只能应用在图片、视频图层上。
  • 变形效果必须明确动画时长或图层时长。
  • 当使用透视效果时,不能使用其他效果!
  • 当使用透视效果时图片、视频不能进行裁剪、翻转、旋转等操作,需保持原样。
  • <b>视频</b> 截取片段时,不能使用透视效果!
  • <b>图片不支持使用动画(图片使用透视动画容易死机,因此不予支持),只能静态转换,如有需要,请使用视频输入</b>
  • <b>图片只能指定一次透视效果</b>
{
    //效果名称:透视变形
    "Name": "Perspective",
    //效果时长
    "Duration": 3,
    // 效果开始时间,以图层开始时间为起点,默认0
    "Offset": 0,
    //左上角X值百分比,默认0,有效值为0~1,-1表示不设置使用默认值
    "X0": -1,
    //左上角Y值百分比,默认0,有效值为0~1,-1表示不设置使用默认值
    "Y0": -1,
    //右上角X值百分比,默认1,有效值为0~1,-1表示不设置使用默认值
    "X1": -1,
    //右上角Y值百分比,默认0,有效值为0~1,-1表示不设置使用默认值
    "Y1": -1,
    //左下角X值百分比,默认0,有效值为0~1,-1表示不设置使用默认值
    "X2": -1,
    //左下角Y值百分比,默认1,有效值为0~1,-1表示不设置使用默认值
    "Y2": -1,
    //右下角X值百分比,默认1,有效值为0~1,-1表示不设置使用默认值
    "X3": -1,
    //右下角Y值百分比,默认1,有效值为0~1,-1表示不设置使用默认值
    public float Y3": -1,
    //插值算法。默认0表示linear,1表示cubic
    "Interpolation": 0,
    //变形模式。默认0表示source即将给定坐标变形到各个角落,1表示destination即将各个角落变形到给定坐标。
    "Sense": 0,
    //坐标表达式计算模式。默认0表示init即在初始化期间仅评估一次,1表示frame即计算每个帧。
    "EvalType": 1,
},
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.6 137 4/28/2025
1.0.5 157 4/3/2025
1.0.4 124 3/28/2025
1.0.3 458 3/26/2025
1.0.2 453 3/26/2025
1.0.1 138 3/19/2025
1.0.0 137 3/19/2025