DEV Community

Discussion on: Creating an bubble animation with javascript

Collapse
 
sp1sp2sp3 profile image
SP1SP2SP3

Hi, I love your bubble script. You've created a great browser window feature!

However, when I check the dev tools in Chrome, there are hundreds of error messages posted "app.js:492 Uncaught TypeError: Failed to execute 'requestAnimationFrame' on 'Window': parameter 1 is not of type 'Function'." for every bubble that's created or moves or disappears.

I have searched the Internet for solutions and the fix seems very easy for a programmer but unfortunately my skills are way too basic. The problem is with passing functions around using setTimeout or something.

Apparently, fix is easy using "requestAnimationFrame(function() {??.update(); });" or requestAnimationFrame(??.update.bind(??));

Can you fix this with your bubble script??

Thanks!! :-)

Collapse
 
mussacharles60 profile image
Mussa Charles

Hi, I just resolve the error issue by surrounding each line with error by try catch block, and everything runs smoothly, please try it ;)
cheers.

Collapse
 
sandeshsapkota profile image
sandeshsapkota

Thank You @sp1sp2sp3 and @Mussa Charles for pointing out and solving the issue . Sorry was away from here . I have updated the script. thanks