Help me to improve my code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help me to improve my code

now this code is only work when we are tapping or moving our finger on screen but i also want to use this effect when we are holding on screen https://code.sololearn.com/W5A1selLbys2/?ref=app

27th Jul 2023, 5:51 PM
Sword 🪄
Sword 🪄 - avatar
2 Answers
+ 1
You have to keep pushing the points continuosly though no touch event is sent. A way is start an interval on touchstart event that push last point every x milliseconds. Es: function starTimer(){ window.setInterval(function(){ genrate(); }, 200); } window.addEventListener("touchstart", function(event){ starTimer() }); Its a very simple code that dont handle touch ending, but is simple to understand
27th Jul 2023, 7:31 PM
KrOW
KrOW - avatar
0
But it's working after we remove our finger from screen I want to stop animation when we remove our fingers
28th Jul 2023, 12:32 AM
Sword 🪄
Sword 🪄 - avatar