GIF to animation
Posted: Mon Feb 24, 2014 8:26 pm
Is there a way to transforme a gif into a LÖVE animation ? (it can be throught ANaL or any other animation code)
I'm currently thinking on making a pokemon clone to test out some of my libs and I wanted to make this clone a little different from others, I wanted to make all pokemon animated like the Black and White (1 and 2) animations, it was realy hard to find the pokemon spriteSheets (front, back, shiny front and shiny back) animations but I came across this website which has ALL of the pokemon in all their state, it's an awesome compilation.
The thing is LÖVE doesn't load gifs, I've tried unpacking a gif but I got 680 pngs as output and I don't want to make huge spriteSheets out all the pngs, maybe my problem here is the program I used to unapck, ffmpeg and this was the command I used:
on this gif:
Then I used this code to pack them all into a png sheet file:
All the code does is it goes throught the frames of the gif (that I got throught ffmpeg) and it "pastes" each frame into a huge sheet (36040x62).
This was the output:
(link to the image on mediafire)
And then I tried loading it into ANaL, I got a static image:
How I loaded it:
So I guess LÖVE doens't load assets that big or I'm doing something wrong, but do you guys have a better ideia to port all gifs into LÖVE ?
I'm currently thinking on making a pokemon clone to test out some of my libs and I wanted to make this clone a little different from others, I wanted to make all pokemon animated like the Black and White (1 and 2) animations, it was realy hard to find the pokemon spriteSheets (front, back, shiny front and shiny back) animations but I came across this website which has ALL of the pokemon in all their state, it's an awesome compilation.
The thing is LÖVE doesn't load gifs, I've tried unpacking a gif but I got 680 pngs as output and I don't want to make huge spriteSheets out all the pngs, maybe my problem here is the program I used to unapck, ffmpeg and this was the command I used:
Code: Select all
ffmpeg -i 494.gif assets\frames\a%d.png
Then I used this code to pack them all into a png sheet file:
Code: Select all
sheet = love.image.newImageData(53*680,62)
local rem = 0
for i,file in ipairs(love.filesystem.getDirectoryItems('assets/frames')) do
if string.find(file, '.png') then
local img = love.graphics.newImage('assets/frames/'..file)
sheet:paste(img:getData(),53*(i-rem)-53,0,0,0,53,62)
else
rem = rem +1
end
end
sheet:encode('sheet.png')]]
This was the output:
(link to the image on mediafire)
And then I tried loading it into ANaL, I got a static image:
How I loaded it:
Code: Select all
function love.load()
test = newAnimation(love.graphics.newImage('assets/sheet.png'),53,62,1,680)
end
function love.update(dt)
test:update(dt)
end
function load.draw()
test:draw(0,0)
end