contextr | pfp image can only accept valid file extensions
kandi X-RAY | contextr Summary
kandi X-RAY | contextr Summary
contextr
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of contextr
contextr Key Features
contextr Examples and Code Snippets
Community Discussions
Trending Discussions on contextr
QUESTION
My Functionality works fine, but after few loops it's slowing down and the "mirrored" video stutters a bit.
Is a way to make it faster/smoother?
I'd like to understand if I chosen the right way on mirroring the videos.
I have clip path in css, and they have to be 3 on which I have video inside mirrored. Firstly looks really good, but then after few loops the mirrored videos run slowly and
Please help.
...ANSWER
Answered 2019-May-23 at 09:52First of, "timeupdate" event is fired multiple times - so you are actually calling draw much more times than you want. This is the reason why it starts lagging - many operations are executed per second. You may probably listen to "play" and "pause" events (fired after play() and pause() methods being executed; "play" event is also called when the video begins, so you don't have to call it manually, it will be fired anyway). Then you can manually handle your drawing loop. That should solve your problem(I was able to reproduce and it fixes the slow down effect).
Also, here are some tips you may consider:
- Do NOT use setTimeout() for animations, especially when playing with canvas. Read about window.requestAnimationFrame(), which is far better, and consider using it instead.
- You may consider many optimizations in that code, for example generating canvas elements in your code(to get rid of ids), using Object.assign() to add multiple properties to an object in the same line, introduce loops. Volume of that code will decrease drastically. It is not a must, but it is always good to maintain code quality. Simply - less work in the future.
Regards and Have a nice day!
Edit: Don't get me wrong, some of this is only about personal preferences. After working quite a lot with js, I like to keep it simple, like in this snippet. Enjoy free code!
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install contextr
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page