Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To hide and show a shape, we can the hide() and show() methods. Try this JSFIDDLE <a href="http://jsfiddle.net/mAX8r/5/" rel="nofollow">http://jsfiddle.net/mAX8r/5/</a>. and You can see the sample code below</p> <pre><code>&lt;!DOCTYPE HTML&gt; &lt;html&gt; &lt;head&gt; &lt;style&gt; body { margin: 0px; padding: 0px; } canvas { border: 1px solid #9C9898; } &lt;/style&gt; &lt;script src="http://www.html5canvastutorials.com/libraries/kinetic-v4.0.3.js"&gt;&lt;/script&gt; &lt;script&gt; var layerBlue; var layerRed; var rectBlue; var rectRed; window.onload = function() { var stage = new Kinetic.Stage({ container: 'container', width: 578, height: 200 }); layerBlue = new Kinetic.Layer(); layerRed = new Kinetic.Layer(); rectBlue = new Kinetic.Rect({ x: 100, y: 75, width: 100, height: 50, fill: 'blue', stroke: 'black', strokeWidth: 4 }); rectRed = new Kinetic.Rect({ x: 300, y: 75, width: 100, height: 50, fill: 'red', stroke: 'black', strokeWidth: 4 }); // mouse events rectBlue.on('click', function() { rectRed.show(); stage.draw(); }); rectRed.on('click', function() { rectRed.hide(); stage.draw(); }); // add the shape to the layer layerBlue.add(rectBlue); layerRed.add(rectRed); // add the layer to the stage stage.add(layerBlue); stage.add(layerRed); rectRed.hide(); stage.draw(); }; &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="container"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Refer this url <a href="http://www.html5canvastutorials.com/kineticjs/html5-canvas-hide-and-show-shape-with-kineticjs/" rel="nofollow">http://www.html5canvastutorials.com/kineticjs/html5-canvas-hide-and-show-shape-with-kineticjs/</a> for HTML5 Canvas Hide and Show a Shape</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload