gifler | Render GIF frames to canvas | Animation library
kandi X-RAY | gifler Summary
kandi X-RAY | gifler Summary
Animate GIFs in canvas.
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 gifler
gifler Key Features
gifler Examples and Code Snippets
Community Discussions
Trending Discussions on gifler
QUESTION
According to this QA, by using "gifler" library, we can use animated gif to render on canvas-based openlayers. can openlayers 3 render the animated marker using gif
But it cannot accept apng/webp, and also, "gifler" library is bit old, it is tough to use with the latest EcmaScript or TypeScript.
Are there any other way to enable this?
...ANSWER
Answered 2021-Jun-13 at 18:29Eventually, I couldn't find a way to make it work, so I started developing it myself. Animated GIF, APNG, and Animated webp can be frame-split and even animated on a canvas context in the following.
QUESTION
Hey everyone so I have a Konvajs application that works great as a video editor running on the vuejs library. However, I want to capture the canvas and create a seamless video at 60 fps. In order to do this, I am trying to utilize the CCapturejs library. It kind of works except for now the playback of the webm is really fast and still a bit choppy. Can any of ya'll look at this code and help me find the problem? Thanks.
...ANSWER
Answered 2020-Apr-13 at 14:49Use this code to pause the video and take screenshots. You can than use Whammy to generate a webm and convert it to whatever file format you like with ffmpeg
QUESTION
so I am trying to mimic this code pen https://codepen.io/airnan/pen/ZLVJmq but when I try to load the same animation in with lottie-web npm package everything works great until the last animation. Then it all gets messed up. I'm trying to figure it out but I am so confused. Any ideas as to why? The JSON file is exactly the same except for text_data variable. I just import the whole thing and access it directly. Heres the code. it's just the last frame that doesn't work. it doesn't animate the text at all instead it looks like this.
...ANSWER
Answered 2020-Apr-07 at 21:50You must use keyframes in order to get the animation to render properly once you do that you will have no issues.
QUESTION
Hey everyone so I have a very complex canvas editor that allows a user to pick a video background, add text, gifs and Lottie animations using the Konvajs and Gifler libraries. It has come a long way however I am trying to speed up the performance of my canvas application. I've read a lot about offscreen canvas but I don't quite understand it. Say I have a regular HTML canvas object how would I create an offscreen canvas and spit that back out to the browser? I would ideally like to be able to get images from the canvas in an array at 30 fps with no latency. I also have another concern that offscreen canvas as of yet does not seem to be widely supported according to caniuse.com. Whenever I try to create an offscreen canvas from my canvas I always get:
...ANSWER
Answered 2020-Mar-28 at 03:32Just like you can't request a context 'B' after you got a context 'A', you can't transfer a DOM canvas's control to an OffscreenCanvas after you did request a context from that canvas.
Here you are using Konva.js library (that I don't particularly know) to initialize your DOM canvas. This library will need to access one of the available contexts (apparently the "2D" one) from that canvas. This means that when you will gain access to that canvas, a context will already have been requested by the library and that you won't be able to transfer its control to an OffscreenCanvas.
There is this issue on the library's repo, which points out that no later than 12 days ago they added some initial support for OffscreenCanvases. So I invite you to look at their example on how to proceed with that library.
About OffscreenCanvas PerformancesAn OffscreenCanvas in itself doesn't offer any performance boost compared to a regular canvas. It won't magically make your code that was running at 10FPS to run at 60FPS.
What it allows is to not block the main thread, and to not be blocked by the main thread. And for this, you need to transfer it to a Web Worker.
This means you may use it
- if you are afraid your canvas code can block the UI but you don't really require smooth animation always.
- if you are afraid your main thread may slow down your canvas animation - e.g if you have a lot of other stuff going on on the page.
But in your case, it seems that there is only your code running. So you will probably not win anything by going this route.
About OffscreenCanvas limitationsWe saw that to really take advantages of an OffscreenCanvas, we need to run it in a parallel thread from a Web Worker. But Web Workers don't have access to the DOM.
This is a huge limitation and will make a lot of things way more harder to handle.
For instance, to draw your video, you currently have no other way than to use a element to play it first. The Worker script can't access that
element, and it can't create one on its own thread. So the only solution is to create an ImageBitmap from the main thread and to pass it back to your Worker script.
All the hard work (video decoding + bitmap generation) is done on the main thread. It is worth noting that even though the createImageBitmap()
method returns a Promise, when we use a video as source, the browser has no other choice than to create the Bitmap from the video synchronously.
So while getting that ImageBitmap for use in your worker, you are actually overloading the main thread, and if the main thread is locked doing something else, you will obviously have to wait it's done before getting your frame from the video.
An other big limitation is that currently* Web Workers can't react to DOM events. So you have to set up a proxy to pass the events received in the main thread to your Worker thread. Once again this requires your main thread to be free and a lot of new code.
About your codeBecause, yeah, I believe this is where you should be looking if you want performance improvements.
I only gave it a quick look, but I already saw that you are using setInterval
in a few places at high rate. Don't. If you need to animate something visible always use requestAnimationFrame
, if you don't need the full speed, then add an inner logic to skip frames, but keep using rAF as the main engine.
You are asking the browser to do heavy actions every frames. For instance your svg part is creating a full new svg markup from the DOM node at every frame, then this markup is loaded in an (this mean the browser has to launch an entire new DOM for that image), and rasterized on a canvas.
This in itself will be hard to cope at high frame-rate, and an OffscreenCanvas won't help.
You are storing all the images as stills to produce your final video. This will take a lot of memory.
There is probably a lot of other stuff like that in your code, so review it thoroughly and search for what make your code not able to reach the screen refresh rate. Improve what can be, search for alternatives (for instance MediaRecorder might be better than Whammy when supported) and good luck.
*There is an ongoing proposal to fix that issue
QUESTION
I did the gif-animation loading, following the example in the documentation. However, frames are skipped and frames are displayed incorrectly.
This happens to many gif files. Please, how to fix it, does anyone know?
Here is an example error:
...ANSWER
Answered 2019-Sep-10 at 07:36You have to try to use another library. I used libgif.js to solve this issue that is an example
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install gifler
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