DALi Version 1.4.27
[platform/core/uifw/dali-demo.git] / resources / scripts / shader-effect-ripple.json
index e32fc1e..24a5fb3 100644 (file)
@@ -1,7 +1,7 @@
 {
   "stage": [
     {
-      "type": "ImageActor",
+      "type": "ImageView",
       "name": "Image1",
       "position": [
         0.40461349487305,
       "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"
+        "url": "{DEMO_IMAGE_DIR}gallery-medium-25.jpg",
+        "desiredWidth": 400,
+        "desiredHeight": 400,
+        "shader": {
+          "fragmentShader": [
+              "precision mediump float;",
+              "uniform sampler2D sTexture;",
+              "uniform vec4 uColor;",
+              "uniform float uAmplitude;",
+              "uniform float uTime;",
+              "varying vec2 vTexCoord;",
+              "void main()",
+              "{",
+              "  highp vec2 pos = -1.0 + 2.0 * vTexCoord;",
+              "  highp float len = length(pos);",
+              "  highp vec2 texCoord = vTexCoord + pos/len * sin( len * 12.0 - uTime * 4.0 ) * uAmplitude;",
+              "  gl_FragColor = texture2D(sTexture, texCoord) * uColor;",
+              "}"
+            ]
+          }
+      },
+      "animatableProperties": {
+        "uAmplitude": 0.02,
+        "uTime": 0.0
       },
       "signals": [
         {
@@ -28,7 +46,6 @@
       ]
     }
   ],
-  "paths": {},
   "animations": {
     "Animation_1": {
       "loop":true,
         }
       ]
     }
-  },
-  "shaderEffects": {
-    "Ripple2D": {
-      "program": {
-        "vertexPrefix": "",
-        "vertex": "void main(void)\n{\n  gl_Position = uMvpMatrix * vec4(aPosition*uSize.xy, 0.0, 1.0);\n  vTexCoord = mix( uTextureRect.xy, uTextureRect.zw, aPosition + vec2(0.5) );\n}\n\n",
-        "fragmentPrefix": "",
-        "fragment": "precision mediump float;\nuniform float uAmplitude; // 0.02; (< 1)\nuniform float uTime;\nvoid main()\n{\n  highp vec2 textureSize = uTextureRect.zw - uTextureRect.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
-    }
   }
 }