X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=plugins%2Fdali-script-v8%2Fdocs%2Fcontent%2Fshader-effect.js;h=8c35f3df175f49551b1f329a9531e63d460c4c1e;hb=6a1e5b837622d06f6cd69dc660cd11d23f7153ba;hp=ea1eba83599e65b1c9bce2713ccd146e225283f0;hpb=e8efa9549ccedae5b8377c9eb331aa8392895879;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/plugins/dali-script-v8/docs/content/shader-effect.js b/plugins/dali-script-v8/docs/content/shader-effect.js index ea1eba8..8c35f3d 100644 --- a/plugins/dali-script-v8/docs/content/shader-effect.js +++ b/plugins/dali-script-v8/docs/content/shader-effect.js @@ -5,7 +5,13 @@ Shader effects provide a visual effect for actors. -For a Custom shader you can provide the vertex and fragment shader code as strings. +You can create a type-registered shader effect by its type name. +``` +// create a new shader effect +var shader = new dali.ShaderEffect("BlindEffect"); +``` + +Alternatively you can create a Custom shader by providing the vertex and fragment shader code as strings. Each shader is provided with default uniforms and attributes. For a vertex shader this part contains the following code: ``` @@ -52,8 +58,9 @@ The API supports functionality such as: + {{#crossLink "ShaderEffect/setUniform:method"}}{{/crossLink}} ### Example of using a custom uniform to brighten an Image (Fragment Shader) - - + +![ ](../assets/img/shaders/fragment-shader-color.png) + ``` createColorEffect = function() { @@ -112,8 +119,9 @@ Like all animatable properties we can also use keyframes to animate the value. ### Example of animating a custom uniform to perform a mask operation (Fragment Shader) In this example we are using the OpenGL discard function to draw an image with a circular mask. - - + +![ ](../assets/img/shaders/fragment-shader-reveal.png) + ``` createRevealEffect = function() { @@ -168,11 +176,12 @@ var animOptions = { // if we go to 1.0 then it will go to a full box shaderAnim.animateTo( revealEffect, "uRadius", 0.5,animOptions); shaderAnim.play(); - +``` * * * ### Example of paper twisting in the wind with color (Vertex + Fragment Shader) - -
+ +![ ](../assets/img/shaders/vertex-shader.png) + The example does the following: @@ -182,10 +191,10 @@ The example does the following: An ImageActor normally only has 4 vertices ( quad ). To allow the image to twist and bend we need it to have more vertices. To do this we can break the image into a grid using the gridX and gridY geometry hints. - - - - + +![ ](../assets/img/shaders/shader-grid-hint.png) + +``` createTwistEffect = function() { @@ -238,7 +247,7 @@ imageActor.setCullFace( dali.CULL_FACE_DISABLE ); // disable face culling so we dali.stage.add( imageActor ); // start it of tilted around the y-axis -imageActor.rotation=new dali.Rotation(90, 0, 1, 0); +imageActor.orientation=new dali.Rotation(90, 0, 1, 0); var twistEffect = createTwistEffect(); imageActor.setShaderEffect( twistEffect );