How to hide all group children using kineticjs?

by ryan.murray , in category: Javascript , 7 months ago

How to hide all group children using kineticjs?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by kadin , 7 months ago

@ryan.murray 

You can hide all group children in KineticJS by setting the opacity of the group to 0. Here is an example code snippet:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
var stage = new Kinetic.Stage({
  container: 'container',
  width: 500,
  height: 500
});

var layer = new Kinetic.Layer();
stage.add(layer);

var group = new Kinetic.Group();

// Add children to group here

layer.add(group);
layer.draw();

// Hide all group children
group.setOpacity(0);
layer.draw();


This code creates a group and adds it to a layer on the stage. To hide all children in the group, you simply set the opacity of the group to 0. This will make all children inside the group invisible. Remember to redraw the layer after making the changes.

Related Threads:

How to check if group has a children or not in kineticjs?
How to group time column into 5 second intervals and count rows using presto?
How to backreference group when using or in regex?
How to hide original image path using .htaccess?
How to hide a button if the user is logged in using elementor?
How to group data in MongoDB using PHP?