javascript - Vue wrote a barrage, but it was very stuck.
淡淡烟草味
淡淡烟草味 2017-05-19 10:12:25
0
6
553

Effects and codes.

http://u6.gg/Skx

After running for a long time, there will be suspended animation or no response or it will start to get a little stuck

Seek optimization or give a solution.

淡淡烟草味
淡淡烟草味

reply all(6)
Peter_Zhu

The barrage increases faster than it disappears. Once the number reaches a certain level, it will definitely become stuck.

The solution is to increase the upper limit of the number of barrage queues.

In addition, because js is continuously called to calculate left, the memory will become larger and larger, which will also cause lag after triggering GC.

But why use requestAnimationFrame? Use css animation

左手右手慢动作

Use css3 animation?

黄舟

The timer keeps adding elements to the page.
You can delete the elements that go to the far left and only keep the elements on the page

Ty80

This.data.barrage.item has 34 items. Control it
Go to the leftmost element and delete it
There is also a log with the console commented out
Try it out

習慣沉默

Using CSS3 animation, the starting position is the left side of the element and the right side of the screen, and the stop position is the right side of the element and the left side of the screen.
Move the element when the animation ends.

洪涛

I have done this before. It is recommended to cover it with canvas. The dom will always be stuck

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!