[cytoscape.js] how to animate selection

1,026 views
Skip to first unread message

dms

unread,
Jul 30, 2013, 4:39:51 PM7/30/13
to cytoscap...@googlegroups.com
Hello -

I am trying to animate a multiple selection.

The scenario is:

the user query multiple nodes ids: (e.g: 26, 123, 444) and the I make the selection like this:

for(var i=0; i<ids.length; i++) {
   cy.nodes("[id=" + (+ids[i]) + "]").select();
     } 


Question 1) is using for the smartest way to select multiple node ?

Question 2) can can I animate the selection ? (i.e. like the .js example, I would like to animate the selection, then the user will have a better sense of where is the selected nodes) 

Thank you for your time.

Cheers.,






Max

unread,
Aug 1, 2013, 2:23:41 PM8/1/13
to cytoscap...@googlegroups.com
(1)

Almost never do anything like that where the elements change state inside a loop.  Instead, make a collection of elements from a query, and call the API function on all of them at once (the proper way to do things, and much more efficient):

cy.$('#n26, #n123, #n444').select()

(2)

Yes, use the eles.animate() functions et al:
--
You received this message because you are subscribed to the Google Groups "cytoscape-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cytoscape-disc...@googlegroups.com.
To post to this group, send email to cytoscap...@googlegroups.com.
Visit this group at http://groups.google.com/group/cytoscape-discuss.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages