vanta icon indicating copy to clipboard operation
vanta copied to clipboard

Why can't I use effect.setOptions from a function on click in javascript

Open Cadris opened this issue 4 years ago • 1 comments

const changeEffect=()=>{ effect.setOptions({ color: 0xff88cc }); }

why can't I do this ? I am new to web dev. I am planning to change the color of the birds on a button click. I wrote this code ->

`const effect = VANTA.BIRDS({ el: "#main", mouseControls: true, touchControls: true, gyroControls: false, minHeight: 200.00, minWidth: 200.00, scale: 1.00, scaleMobile: 1.00, color1: 0xacff, color2: 0x60ff00 });

const changeEffect=()=>{ effect.setOptions({ color: 0xff88cc }); }`

But It is not happening.

I am calling the changeEffect on a button click.

Cadris avatar Feb 25 '21 18:02 Cadris

@cadris did you ever figure this out?

notserpp avatar Aug 18 '21 21:08 notserpp