force-graph icon indicating copy to clipboard operation
force-graph copied to clipboard

Can the blinking function be applied?

Open NoviceInWeb opened this issue 3 years ago • 4 comments

Hi, I draw 2d-graph with default symbol and image symbol. when I click node, I want to add a function that blinking once per second. However, the node did not change. Am I doing something wrong? Or is it a function that shouldn't be?

thank you!

NoviceInWeb avatar Apr 30 '22 16:04 NoviceInWeb

@NoviceInWeb thanks for reaching out.

There is no built-in functionality in this module to blink nodes. You'd have to code that yourself, but it should be doable. If you use nodeCanvasObject to render you custom node, that method gets invoked once at every frame. Thus all you'd need is some interpolation function that determines the node opacity/visibility in function of time, according to your needs.

vasturiano avatar May 01 '22 13:05 vasturiano

@vasturiano thank you for answer.

I try to add my blink function. But it blinks irregularly.

What's wrong with this code??😒 thank you...

my code: https://codepen.io/LolaKane/pen/YzePQLa

NoviceInWeb avatar May 03 '22 02:05 NoviceInWeb

@NoviceInWeb you were close. You just had to move the setInterval creation out of the nodeVisibility method, otherwise you're creating a new interval at every frame, leading into an enormous amount of interval events. https://codepen.io/vasturiano/pen/eYVNOyQ

vasturiano avatar May 03 '22 22:05 vasturiano

oh, It works nice and clearly. 👌 thank you very much. Bye!

NoviceInWeb avatar May 04 '22 02:05 NoviceInWeb