Closed vincerubinetti closed 10 years ago
Probably due to you running it from disk instead of a web server
Not the case. Thank you for the prompt response, and I apologize for the lack of detail. Was writing this very late at night and exhausted.
See here: http://vincentrubinetti.com/apps/test/Gyrographer.html Press "Export Animated GIF" and look in the console.
Here's my set up:
animate step function { animate step++ draw new canvas add frame with gif.js if animate done { render gif.js } else { setTimeout this step function 10 ms } }
It might have something to do with the htaccess... I'll fool around with that.
You need to set the workerScript url if it's not in the same dir as the page
I did:
encoder = new GIF({width: Canvas.width, height: Canvas.height, workers: 2, quality: 10, workerScript: 'App/gif'});
Does it have to be an absolute path?
it needs to be a url to the actual script, not the directory it resides in
Very good, got it working. Thank you! Perhaps you should make that clear in the workerScript description in the readme to avoid future confusion.
It's pretty clear already IMHO
@jnordberg Is there any suggestion to use it in a webpack project(like vuejs), since it is a one-js-file project.
@ionull No, not really. The worker script is loaded through the browsers loading system, maybe that can be monkeypatched to do something but i doubt it.
@jnordberg I found something like worker-loader workerjs project which will load worker from file. But in gif.js project we must use a file path instead of worker instance.
See https://github.com/jnordberg/gif.js/issues/58, https://github.com/jnordberg/gif.js/issues/47; @ZigGreen was able to load the worker with a blob URL. You could use webpack-contrib/raw-loader or similar to dynamically inline the file in the resulting bundle.
@1j01 thanks a lot, I used file loader minutes ago, it is now working well :) Blob is not compatible well with some IE browser
Can anyone think of any reason I would be getting such output from gif.js?