Skip to content

eles.collapse(timing?)

eles.collapse — Collection > Compound nodes. Cytoscape.js signatures, parameters and return contract.

eles.collapse — Collection › Compound nodes

Preview · Collection › Compound nodes

Read in the complete API reference · All API members

// Scale each compound parent’s descendants into a miniature around the parent’s current centre
eles.collapse(timing?: Pick<AnimateOptions, 'duration' | 'easing'>): this

Scale each compound parent’s descendants into a miniature around the parent’s current centre. Pass { duration, easing } to animate the scale; without options, the operation is immediate. The original nodes, edges and explicit visibility state remain unchanged.

Parameters
NameDescription
timing: Pick<AnimateOptions, 'duration' | 'easing'>?

optional animation duration and easing

Returns this

this collection, for chaining

Example

const parent = cy.add({ data: { id: 'parent' } });
cy.getElementById('a').move({ parent: 'parent' });
parent.collapse();
console.log(parent.collapsed()); // true

Example graph and handle setup