0
Function loop
Hi. Textmirror function smoothly changes the opacity of the text once to zero and back to one. If it is applied, as in line 36, then everything will be fine, but if you combine it with other functions, it goes into an infinite loop. I do not understand how why. https://code.sololearn.com/WaW0uMFEgKb1/?ref=app
3 odpowiedzi
+ 13
I once had that problem too.
Use a control variable to decide if the signum of the opacity change will be positive or negative. Or use it as a sign whether the opacity change has endes and start next one afterwards...
0
I found... There is a saying in Russian programmers:"global variables are evil". This is the case). Twice used one variable
0
By the way do you know how to assign variables inside the function when using the "setInterval"? If you do so, then with each call, the variables will be reset to the initial values .