Skip to content

Commit

Permalink
Data: 滤镜动画
Browse files Browse the repository at this point in the history
  • Loading branch information
Dituon committed Nov 16, 2023
1 parent 2ffcd72 commit 8f5bf02
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 26 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,28 @@
}
```

滤镜可使用数组实现动画, 例如:

```json lines
{
"type": "GIF",
"background": {
"length": 5, // GIF 长度是 5 帧
"size": ["avatar0Width", "avatar0Height"] // 画布的尺寸为第一个头像的尺寸
},
"avatar": [{
"type": "TO",
"pos": [0, 0, "width", "height"], // 图像占满画布
//省略...
"filter": [{
"type": "SWIRL",
"angle": [0, 1.2, 2.4, 3.6, 4.8] // 对应每一帧的动画
}]
}]
//省略...
}
```

<details><summary>实现差异对比</summary>

![实现差异对比](https://s2.loli.net/2023/11/01/n5dZ2SyQkNFWzCu.jpg)
Expand Down
31 changes: 15 additions & 16 deletions data/xmmt.dituon.petpet/bulge/data.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
{
"type": "IMG",
"avatar": [{
"type": "TO",
"pos": [0,0,"width","height"],
"filter": [{
"type": "BULGE",
"strength": 0.5
}],
"avatarOnTop": true
}],
"text": [],
"background": {
"size": ["avatar0Width","avatar0Height"]
},
"alias": ["透镜", "凸透镜", "鱼眼"],
"inRandomList": true
"type": "GIF",
"avatar": [{
"type": "TO",
"pos": [[0, 0, "width", "height"]],
"filter": [{
"type": "BULGE",
"strength": [0.1, 0.15, 0.25, 0.5, 0.8, 0.6, 0.35, 0.2, 0]
}]
}],
"text": [],
"background": {
"size": ["avatar0Width", "avatar0Height"],
"length": 10
},
"alias": ["膨胀", "鱼眼", "透镜"]
}
16 changes: 16 additions & 0 deletions data/xmmt.dituon.petpet/oil/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"type": "IMG",
"avatar": [{
"type": "TO",
"pos": [[0, 0, "width", "height"]],
"filter": [{
"type": "SWIRL",
"angle": 3
}]
}],
"text": [],
"background": {
"size": ["avatar0Width", "avatar0Height"]
},
"alias": ["油画"]
}
11 changes: 6 additions & 5 deletions data/xmmt.dituon.petpet/pinch/data.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
{
"type": "IMG",
"type": "GIF",
"avatar": [{
"type": "TO",
"pos": [0,0,"width","height"],
"pos": [[0, 0, "width", "height"]],
"filter": [{
"type": "BULGE",
"strength": -0.5
"strength": [-0.1, -0.15, -0.25, -0.5, -0.8, -0.6, -0.35, -0.2, 0]
}],
"avatarOnTop": true
}],
"text": [],
"background": {
"size": ["avatar0Width","avatar0Height"]
"size": ["avatar0Width","avatar0Height"],
"length": 10
},
"alias": ["透镜", "凹透镜", "捏合"],
"alias": ["透镜", "收缩", "捏合"],
"inRandomList": true
}
17 changes: 17 additions & 0 deletions data/xmmt.dituon.petpet/rgb/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"type": "GIF",
"avatar": [{
"type": "TO",
"pos": [[0, 0, "width", "height"]],
"filter": [{
"type": "HSB",
"hue": [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]
}]
}],
"text": [],
"background": {
"size": ["avatar0Width", "avatar0Height"],
"length": 10
},
"alias": ["变色"]
}
22 changes: 22 additions & 0 deletions data/xmmt.dituon.petpet/swim/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"type": "GIF",
"avatar": [{
"type": "TO",
"pos": [[0, 0, "width", "height"]],
"filter": [{
"type": "SWIM",
"amount": 15,
"angle": [12, 0, 8, 26],
"scale": 36,
"stretch": 1,
"turbulence": [1, 1, 1.2, 1],
"time": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
}]
}],
"text": [],
"background": {
"size": ["avatar0Width", "avatar0Height"],
"length": 10
},
"alias": ["潜水", "游泳", "水下"]
}
12 changes: 7 additions & 5 deletions data/xmmt.dituon.petpet/swirl/data.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
{
"type": "IMG",
"type": "GIF",
"avatar": [{
"type": "TO",
"pos": [0,0,"width","height"],
"style": ["MIRROR"],
"pos": [[0,0,"width","height"]],
"filter": [{
"type": "SWIRL"
"type": "SWIRL",
"angle": [0,0.6,1.5,2.2,3,4,-5,-3.6,-2.2,-0.8]
}],
"avatarOnTop": true
}],
"text": [],
"background": {
"size": ["avatar0Width","avatar0Height"]
"size": ["avatar0Width","avatar0Height"],
"length": 10
},
"delay": 100,
"alias": ["扭曲"],
"inRandomList": true
}

0 comments on commit 8f5bf02

Please sign in to comment.