+1

Need help in Canvas !

Let me know whats wrong in line : 18 . Thanks https://code.sololearn.com/Wp0xMkco8v44/?ref=app https://code.sololearn.com/Wp0xMkco8v44/?ref=app

3/30/2020 4:54:18 PM

rawaha. pool

10 Answers

New Answer

+3

Gordon Why enclosing the whole IIFE in one more function block? Rather assign the anonymous function to the onload event by removing the outer round brackets: ;(function() { /*...*/ })(); would becomes: onload = function() { /*...*/ }

+2

TRY THIS and your code very amazing How to learn please tell me? For diffrent color You use in fillStyle --------------- ctx.fillStyle = "hsl("+color+"+100%+50%)"; Color = 360*Math.random(); color++; ---------

+1

The scripts in JS tab runs before the scripts in HTML tab, so the getElementById("bubble") returns null because at that time the element has not been rendered yet. https://www.sololearn.com/post/90825/?ref=app Enclose your whole IIFE in a window.onload anonymous function code block. https://code.sololearn.com/WY1UbAX3fpJ8/?ref=app

+1

Hey! Bro Example canvas https://code.sololearn.com/WV5GMtCTD2st/?ref=app

+1

Hey! bro Example svg https://code.sololearn.com/W0txWg4obC59/?ref=app

+1

Hey! Aditya bro let me know if you have any solutions for this. I just want the balls to not merge! And only three ball rotating . All of them should be of different color. :) let me know if you got any solutions for that.. https://code.sololearn.com/Wg5dYODFYJn2/?ref=app

0

Thank you very much Visph !

0

visph good way too 👍

0

Thanks Gordon!

0

Bro can you please send me the code?