UNPKG

dragonbones-tools

Version:
437 lines (318 loc) 17.2 kB
# DragonBones 5.5 JSON 数据格式 [English](./dragonbones_json_format_5.5.md) ```javascript { // 龙骨数据名称。 "name": "dragonBonesName", // 数据版本。 "version": "5.5", // 数据兼容的最低版本。 "compatibleVersion": "5.5", // 动画帧率。 (可选属性,默认:24) "frameRate": 24, // 自定义数据。 (可选属性,默认:null) "userData": null, // 骨架列表。 (可选属性,默认:null) "armature": [{ // 骨架名称。 "name": "armatureName", // 动画帧率。 (可选属性,默认:null) // [null: 使用龙骨数据的帧率, N: 动画帧率] "frameRate": 24, // 非必要。 "type": "Armature", // 自定义数据。 (可选属性,默认:null) "userData": null, // 当该骨架做为子骨架加入到父骨架时的默认行为列表。 (可选属性,默认:null) "defaultActions": [ { "gotoAndPlay": "animationName" } ], // 骨骼列表。 (可选属性,默认:null) "bone": [{ // 骨骼名称。 "name": "boneName", // 父骨骼名称。 (可选属性,默认:null) "parent": "parentBoneName", // 自定义数据。 (可选属性,默认:null) "userData": null, // 该骨骼相对与父骨骼或骨架的基础变换。 (可选属性,默认:null) "transform": { "x": 0.0, // 水平位移。 (可选属性,默认:0.0) "y": 0.0, // 垂直位移。 (可选属性,默认:0.0) "skX": 0.0, // 水平倾斜。 (可选属性,默认:0.0) "skY": 0.0, // 垂直倾斜。 (可选属性,默认:0.0) "scX": 1.0, // 水平缩放。 (可选属性,默认:1.0) "scY": 1.0 // 垂直缩放。 (可选属性,默认:1.0) } }], // 插槽列表。 "slot": [{ // 插槽名称。 "name": "slotName", // 父骨骼名称。 "parent": "parentBoneName", // 默认的显示对象索引。 (可选属性,默认:0) "displayIndex": 0, // 混合模式。 (可选属性,默认:null) "blendMode": null, // 自定义数据。 (可选属性,默认:null) "userData": null, // 颜色变换。 (可选属性,默认:null) "color": { "aM": 100, // 透明相乘因子。 [0~100] (可选属性,默认:100) "rM": 100, // 红色相乘因子。 [0~100] (可选属性,默认:100) "gM": 100, // 绿色相乘因子。 [0~100] (可选属性,默认:100) "bM": 100, // 蓝色相乘因子。 [0~100] (可选属性,默认:100) "aO": 0, // 透明偏移。 [-255~255] (可选属性,默认:0) "rO": 0, // 红色偏移。 [-255~255] (可选属性,默认:0) "gO": 0, // 绿色偏移。 [-255~255] (可选属性,默认:0) "bO": 0, // 蓝色偏移。 [-255~255] (可选属性,默认:0) } }], // 皮肤列表。 "skin": [{ // 皮肤名称。 "name": "skinName", // 插槽列表。 "slot": [{ // 插槽名称。 "name": "slotName", // 显示对象列表。 "display": [{ // 显示对象名称。 "name": "displayName", // 显示对象类型。 (可选属性,默认:"image") // ["image": 贴图的矩形, "armature": 嵌套的子骨架, "mesh": 贴图的网格, "boundingBox": 自定义边界框] "type": "image", // 显示对象的资源路径。 (可选属性,默认:null) "path": null, // 共享网格的名称。 (可选属性,默认:null) "share": "meshName", // 是否继承共享网格的形变动画。 (可选属性,默认:true) "inheritDeform": true, // 显示对象的子类型。 // 如果是边界框: (可选属性,默认:"rectangle") // ["rectangle": 矩形边界框, "ellipse": 椭圆边界框, "polygon": 多边形边界框] "subType": "rectangle", // 非必要。 "color": 0x000000, // 相对于骨骼的变换。 (可选属性,默认:null) "transform": { "x": 0.0, // 水平位移。 (可选属性,默认:0.0) "y": 0.0, // 垂直位移。 (可选属性,默认:0.0) "skX": 0.0, // 水平倾斜。 (可选属性,默认:0.0) "skY": 0.0, // 垂直倾斜。 (可选属性,默认:0.0) "scX": 1.0, // 水平缩放。 (可选属性,默认:1.0) "scY": 1.0 // 垂直缩放。 (可选属性,默认:1.0) }, // 相对轴点。 (可选属性,默认:null) "pivot": { "x": 0.5, // 水平位移。 [0.0~1.0] (可选属性,默认:0.5) "y": 0.5, // 垂直位移。 [0.0~1.0] (可选属性,默认:0.5) }, // 显示对象的尺寸。 (仅对边界框有效) "width": 100, "height": 100, "vertices": [-64.0, -64.0, 64.0, -64.0, 64.0, 64.0, -64.0, 64.0], "uvs": [0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0], "triangles": [0, 1, 2, 2, 3, 0], "weights": [1, 0, 1.0, 2, 0, 0.5, 1, 0.5], "slotPose": [1.0, 0.0, 0.0, 1.0, 0.0, 0.0], "bonePose": [0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0], // 替换子骨架的默认行为列表。 (可选属性,默认:null) "actions": [ { "gotoAndPlay": "animationName" } ] }] }] }], // IK 约束列表。 "ik": [{ // IK 约束名称。 "name": "ikContaintName", // 约束骨骼的名称。 "bone": "boneName", // 约束目标骨骼的名称 "target": "ikBoneName", // IK 约束的方向。 (可选属性,默认:true) // [true: 正方向 / 顺时针, false: 反方向 / 逆时针] "bendPositive": true, // 被约束的骨骼链长度。 // [0: 至约束骨骼, N: 该骨骼和向上 N 级的父骨骼] (可选属性,默认:0) "chain": 0, // 约束权重。 [0.0~1.0] (可选属性,默认:1.0) "weight": 1.0 }], // 动画列表。 "animation": [{ // 动画名称。 "name": "animationName", // 动画播放次数。 [0: 循环播放, N: 播放 N 次] (可选属性,默认:1) "playTimes": 1, // 动画长度。 (可选属性,默认:1) "duration": 1, // 行为关键帧列表。 (可选属性,默认:null) "frame": [{ // 关键帧长度。 (可选属性,默认:1) "duration": 1, // 该帧的行为列表。 (可选属性,默认:null) "actions": [{ // 行为类型。 [0: 播放动画, 10: 帧事件, 11: 帧声音事件] (可选属性,默认:0) "type": 0, // 行为的名称。 (动画名称或事件名称) "name": "actionName", // 骨骼名称。 (可选属性,默认:null) "bone": "boneName", // 插槽名称。 (可选属性,默认:null) "slot": "slotName", // 自定义数据列表。 (可选属性,默认:null) "ints":[012], "floats":[0.011.012.01], "strings":["a", "b", "c"] }] }], // z 排序时间轴。 "zOrder": { "frame": [{ // 关键帧长度。 (可选属性,默认:1) "duration": 1, // 该帧插槽 z 排序偏移列表。 [slotIndexA, offsetA, slotIndexB, offsetB, ...] (可选属性,默认:null) "zOrder": [0, 2, 4, 1, 6, -1] }] }, // 骨骼时间轴列表。 "bone": [{ // 骨骼名称。 "name": "boneName", // 时间轴缩放。 (可选属性,默认:0.0) "scale": 1.0, // 时间轴偏移。 (可选属性,默认:0.0) "offset": 0.0, // 位移关键帧列表。 (可选属性,默认:null) "translateFrame": [{ // 关键帧长度。 (可选属性,默认:1) "duration": 1, // 补间类型 [0.0: 线形, null: 不补间]. (可选属性,默认:0) "tweenEasing": 0.0, // 补间贝塞尔曲线。 [x1, y1, x2, y2, ...] (可选属性,默认:null) "curve": [0.0, 0.0, 1.0, 1.0], // 该帧骨骼的水平位移。 (可选属性,默认:0.0) "x": 0.0, // 该帧骨骼的垂直位移。 (可选属性,默认:0.0) "y": 0.00, }], // 旋转关键帧列表。 (可选属性,默认:null) "rotateFrame": [{ // 关键帧长度。 (可选属性,默认:1) "duration": 1, // 补间类型 [0.0: 线形, null: 不补间]. (可选属性,默认:0) "tweenEasing": 0.0, // 补间贝塞尔曲线。 [x1, y1, x2, y2, ...] (可选属性,默认:null) "curve": [0.0, 0.0, 1.0, 1.0], // 补间的旋转方式。 (可选属性,默认:0) // [0: 最小角度旋转, 1: 顺时针旋转, -1: 逆时针旋转, N: 至少顺时针旋转 N 圈, -N: 至少逆时针旋转 N 圈] "clockwise": 0, // 该帧骨骼的旋转。 [-PI ~ PI] (可选属性,默认:0.0) "rotate": 0.0, // 该帧骨骼的倾斜。 [-PI ~ PI] (可选属性,默认:0.0) "skew": 0.0 }], // 缩放关键帧列表。 (可选属性,默认:null) "scaleFrame": [{ // 关键帧长度。 (可选属性,默认:1) "duration": 1, // 补间类型 [0.0: 线形, null: 不补间]. (可选属性,默认:0) "tweenEasing": 0.0, // 补间贝塞尔曲线。 [x1, y1, x2, y2, ...] (可选属性,默认:null) "curve": [0.0, 0.0, 1.0, 1.0], // 该帧骨骼的水平缩放。 (可选属性,默认:1.0) "x": 1.0, // 该帧骨骼的垂直缩放。 (可选属性,默认:1.0) "y": 1.0 }] }], // 插槽时间轴列表。 "slot": [{ // 时间轴名称。 "name": "slotName", // 显示关键帧列表。 (可选属性,默认:null) "displayFrame": [{ // 关键帧长度。 (可选属性,默认:1) "duration": 1, // 该帧插槽的显示对象索引。 (可选属性,默认:1) "value": 0, // 该帧嵌套子骨架的行为列表。 (可选属性,默认:null) "actions": [ { "gotoAndPlay": "animationName" } ] }], // 颜色关键帧列表。 (可选属性,默认:null) "colorFrame": [{ // 关键帧长度。 (可选属性,默认:1) "duration": 1, // 补间类型 [0.0: 线形, null: 不补间]. (可选属性,默认:0) "tweenEasing": 0.0, // 补间贝塞尔曲线。 [x1, y1, x2, y2, ...] (可选属性,默认:null) "curve": [0.0, 0.0, 1.0, 1.0], // 该帧插槽的颜色变换。 (可选属性,默认:null) "color": { "aM": 100, // 透明相乘因子。 [0~100] (可选属性,默认:100) "rM": 100, // 红色相乘因子。 [0~100] (可选属性,默认:100) "gM": 100, // 绿色相乘因子。 [0~100] (可选属性,默认:100) "bM": 100, // 蓝色相乘因子。 [0~100] (可选属性,默认:100) "aO": 0, // 透明偏移。 [-255~255] (可选属性,默认:0) "rO": 0, // 红色偏移。 [-255~255] (可选属性,默认:0) "gO": 0, // 绿色偏移。 [-255~255] (可选属性,默认:0) "bO": 0, // 蓝色偏移。 [-255~255] (可选属性,默认:0) } }] }], // FFD 时间轴列表。(可选属性,默认:null) "ffd": [{ // 网格名称。 "name": "meshName", // 皮肤名称。 "skin": "skinName", // 插槽名称。 "slot": "slotName", "frame": [{ // 关键帧长度。 (可选属性,默认:1) "duration": 1, // 补间类型 [0.0: 线形, null: 不补间]. (可选属性,默认:0) "tweenEasing": 0.0, // 补间贝塞尔曲线。 [x1, y1, x2, y2, ...] (可选属性,默认:null) "curve": [0.0, 0.0, 1.0, 1.0], // 变形顶点列表的索引偏移,偏移之前的数据都是 0。 (可选属性,默认:0) "offset": 0, // 变形顶点列表,队尾为 0 的数据会别省略。 // [x0, y0, x1, y1, ...] (可选属性,默认:null) "vertices": [0.1, 0.1] }] }], // IK 约束时间轴。 (可选属性,默认:null) "ik": [{ // IK 约束名称。 "name": "meshName", "frame": [{ // 关键帧长度。 (可选属性,默认:1) "duration": 1, // 补间类型 [0.0: 线形, null: 不补间]. (可选属性,默认:0) "tweenEasing": 0.0, // 补间贝塞尔曲线。 [x1, y1, x2, y2, ...] (可选属性,默认:null) "curve": [0.0, 0.0, 1.0, 1.0], // 该帧 IK 约束的方向。 (可选属性,默认:true) "bendPositive": true, // 该帧 IK 约束的权重。 (可选属性,默认:1.0) "weight": 1.0 }] }] }] }] } ```