shader-effect-ripple.json
1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{
"stage": [
{
"type": "ImageActor",
"name": "Image1",
"position": [
0.40461349487305,
0.9150390625,
0.0
],
"parentOrigin": [0.5, 0.5, 0.5],
"widthResizePolicy":"FILL_TO_PARENT",
"heightResizePolicy":"DIMENSION_DEPENDENCY",
"effect": "Ripple2D",
"image": {
"filename": "{DALI_IMAGE_DIR}gallery-medium-25.jpg",
"width": 400,
"height": 400,
"loadPolicy": "IMMEDIATE",
"releasePolicy": "NEVER"
},
"signals": [
{
"name": "onStage",
"action": "play",
"animation": "Animation_1"
}
]
}
],
"paths": {},
"animations": {
"Animation_1": {
"loop":true,
"properties": [
{
"actor": "Image1",
"property": "uTime",
"value": 36.0,
"alphaFunction": "LINEAR",
"timePeriod": {
"delay": 0,
"duration": 20.0
},
"guiBuilderTimelineColor": "#8dc0da"
}
]
}
},
"shaderEffects": {
"Ripple2D": {
"program": {
"vertexPrefix": "",
"vertex": "void main(void)\n{\n gl_Position = uProjection * uModelView * vec4(aPosition, 1.0);\n vTexCoord = aTexCoord;\n}\n\n",
"fragmentPrefix": "",
"fragment": "precision mediump float;\nuniform float uAmplitude; // 0.02; (< 1)\nuniform float uTime;\nvoid main()\n{\n highp vec2 textureSize = sTextureRect.zw - sTextureRect.xy;\n highp vec2 pos = -1.0 + 2.0 * vTexCoord.st/textureSize;\n highp float len = length(pos);\n highp vec2 texCoord = vTexCoord.st/textureSize + pos/len * sin( len * 12.0 - uTime * 4.0 ) * uAmplitude; \n gl_FragColor = texture2D(sTexture, texCoord) * uColor;\n}\n\n\n",
"geometryType": "GEOMETRY_TYPE_IMAGE"
},
"geometryHints": "HINT_NONE",
"gridDensity": 0,
"loop": true,
"uAmplitude": 0.02,
"uTime": 0.0
}
}
}