Comment On Technically, It's Still GIF Animation

I'll be honest. Code submissions come into our queue sometimes and I have to read them a few times before I can identify the WTF. When Alex asked me to write this one up, I had to read it over line-by-line for almost an hour and figure out what was wrong with it. [expand full text]
« PrevPage 1 | Page 2 | Page 3Next »

Re: Technically, It's Still GIF Animation

2009-03-30 09:02 • by LightStyx (unregistered)
First...

Re: Technically, It's Still GIF Animation

2009-03-30 09:05 • by See Sharp (unregistered)
if (img.src.indexOf("First")!=-1) {
img.src="Second"
...

Re: Technically, It's Still GIF Animation

2009-03-30 09:05 • by Addison (unregistered)
*claps slowly*

At first I thought "well maybe they didn't want to use .gifs. Then I realized that they were using them anyway. Plus you just KNOW someone spent ll afternoon making those 4 images. And they probably had the experience to make them into a .gif.
I guess when some people get an idea in their head about how to fix something nothing will stop them. Not even many many CPU cycles!

Re: Technically, It's Still GIF Animation

2009-03-30 09:06 • by LightStyx
Now for the comment...

here's an easy way around that... just create the gif animation in GIMP as one file then stick it in there. Why would one need programming to animate a gif when they themselves are already animated?

Re: Technically, It's Still GIF Animation

2009-03-30 09:06 • by Addison (unregistered)
Nooo, I made the infamous "didn't close quotes grammar mistake.

Re: Technically, It's Still GIF Animation

2009-03-30 09:08 • by illtiz (unregistered)
252326 in reply to 252324
LightStyx:
Now for the comment...

here's an easy way around that... just create the gif animation in GIMP as one file then stick it in there. Why would one need programming to animate a gif when they themselves are already animated?


Is it me or does the article point that out itself?

But kudos on being Fist.

Re: Technically, It's Still GIF Animation

2009-03-30 09:15 • by Bobbo
252327 in reply to 252326
illtiz:
LightStyx:
Now for the comment...

here's an easy way around that... just create the gif animation in GIMP as one file then stick it in there. Why would one need programming to animate a gif when they themselves are already animated?


Is it me or does the article point that out itself?

But kudos on being Fist.


Hang on, doesn't it say that in the article?

Re: Technically, It's Still GIF Animation

2009-03-30 09:16 • by Whole Wheat Noodles (unregistered)
252328 in reply to 252324
LightStyx:
Now for the comment...

here's an easy way around that... just create the gif animation in GIMP as one file then stick it in there. Why would one need programming to animate a gif when they themselves are already animated?


Wow. You do realise the purpose of this site?

Re: Technically, It's Still GIF Animation

2009-03-30 09:17 • by Zhango! (unregistered)
...but I have animated GIFs shut off in my browser, so there!

Which reminds me, he forgot the code for what to do if JavaScript is shut off.

Re: Technically, It's Still GIF Animation

2009-03-30 09:18 • by HVS (unregistered)
Actually, there is a perfectly good reason to do this. If you have a "report running" page that has been submitted, Firefox will often stop all running animations on the page. This is not a problem in IE. By doing it with javascript, it avoids this problem.

Re: Technically, It's Still GIF Animation

2009-03-30 09:20 • by kaspar (unregistered)
252331 in reply to 252329
iframe, with meta refresh tag and some serverside mechanism to determine the next picture :).

Re: Technically, It's Still GIF Animation

2009-03-30 09:21 • by illtiz (unregistered)
252332 in reply to 252327
Bobbo:
illtiz:
LightStyx:
Now for the comment...

here's an easy way around that... just create the gif animation in GIMP as one file then stick it in there. Why would one need programming to animate a gif when they themselves are already animated?


Is it me or does the article point that out itself?

But kudos on being Fist.


Hang on, doesn't it say that in the article?


Come to think of it, the article mentions the same thing already.

Re: Technically, It's Still GIF Animation

2009-03-30 09:22 • by whatever (unregistered)
252333 in reply to 252324
LightStyx:
First...


LightStyx:
Now for the comment...

here's an easy way around that... just create the gif animation in GIMP as one file then stick it in there. Why would one need programming to animate a gif when they themselves are already animated?


O....M......G......!!!!

You submit a 'first post' which is soooo lame it's ludicrous, and then 4 minutes later post a comment that is spelled out right there in the article.

Wow.

Re: Technically, It's Still GIF Animation

2009-03-30 09:25 • by Run This (unregistered)
252334 in reply to 252330
HVS:
Actually, there is a perfectly good reason to do this. If you have a "report running" page

Remind me again why we need that cute dancing cartoon? Oh yeah it is to reassure the timid little untrainable luser that his precious report is still running. Even if it isn't. Damn lying GUI designers. Hey but at least it's colorful.

Re: Technically, It's Still GIF Animation

2009-03-30 09:27 • by LightStyx (unregistered)
252335 in reply to 252328
Whole Wheat Noodles:
LightStyx:
Now for the comment...

here's an easy way around that... just create the gif animation in GIMP as one file then stick it in there. Why would one need programming to animate a gif when they themselves are already animated?


Wow. You do realise the purpose of this site?


... it's to be the 1st poster, right?

Re: Technically, It's Still GIF Animation

2009-03-30 09:27 • by Peter (unregistered)
animFrame = animFrame % 6 + 1;

should be:
animFrame = (animFrame + 1) % 6;

Re: Technically, It's Still GIF Animation

2009-03-30 09:31 • by illtiz (unregistered)
252337 in reply to 252336
Peter:
animFrame = animFrame % 6 + 1;

should be:
animFrame = (animFrame + 1) % 6;


That's the common thing to do, but the index is supposed to be [ 1 .. 6 ] not [ 0 .. 5 ] here.

Re: Technically, It's Still GIF Animation

2009-03-30 09:32 • by Ironic (unregistered)
The ajaxload.info site is broken - I get stuck with this crappy loading animation whenever I try to click something.

Re: Technically, It's Still GIF Animation

2009-03-30 09:33 • by jspenguin
I see the WTF. They're passing a string to setTimeout. They should pass a function object, so it doesn't have to recompile the code every 200 ms:
setTimeout(Animate, 200)
Or, even better, they could call setInterval once and it will automatically reschedule the timer.

I hate when people don't take the time to read the API documentation.

Re: Technically, It's Still GIF Animation

2009-03-30 09:36 • by cdosrun
252340 in reply to 252332
illtiz:
Bobbo:
illtiz:
LightStyx:
Now for the comment...

here's an easy way around that... just create the gif animation in GIMP as one file then stick it in there. Why would one need programming to animate a gif when they themselves are already animated?


Is it me or does the article point that out itself?

But kudos on being Fist.


Hang on, doesn't it say that in the article?


Come to think of it, the article mentions the same thing already.


Check out http://thedailywtf.com/Articles/Technically,-Its-Still-GIF-Animation.aspx for an easy alternative to animated GIFs

Re: Technically, It's Still GIF Animation

2009-03-30 09:37 • by Jay (unregistered)
252341 in reply to 252332
illtiz:
Bobbo:
illtiz:
LightStyx:
Now for the comment...

here's an easy way around that... just create the gif animation in GIMP as one file then stick it in there. Why would one need programming to animate a gif when they themselves are already animated?


Is it me or does the article point that out itself?

But kudos on being Fist.


Hang on, doesn't it say that in the article?


Come to think of it, the article mentions the same thing already.


I think I read something in the article that says something similar to this...

CAPTCHA: persto (damn those typos >.< )

Re: Technically, It's Still GIF Animation

2009-03-30 09:38 • by illtiz (unregistered)
252342 in reply to 252340
cdosrun:
illtiz:
Bobbo:
illtiz:
LightStyx:
Now for the comment...

here's an easy way around that... just create the gif animation in GIMP as one file then stick it in there. Why would one need programming to animate a gif when they themselves are already animated?


Is it me or does the article point that out itself?

But kudos on being Fist.


Hang on, doesn't it say that in the article?


Come to think of it, the article mentions the same thing already.


Check out http://thedailywtf.com/Articles/Technically,-Its-Still-GIF-Animation.aspx for an easy alternative to animated GIFs


Thanks! Also, more useful information and links can be found at http://thedailywtf.com/Comments/Technically,-Its-Still-GIF-Animation.aspx

Re: Technically, It's Still GIF Animation

2009-03-30 09:45 • by Ancient_Hacker (unregistered)
252343 in reply to 252321
Ah, no, the real underlying problems are much deeper than that. They're checking for the existence of one snippet of text, then building a path using part of the name, and by induction guessing the next name, then loading an image and not checking to see if it actually was there to load and it did load.

Re: Technically, It's Still GIF Animation

2009-03-30 09:45 • by Ted (unregistered)
252344 in reply to 252342
illtiz:
cdosrun:
illtiz:
Bobbo:
illtiz:
LightStyx:
Now for the comment...

here's an easy way around that... just create the gif animation in GIMP as one file then stick it in there. Why would one need programming to animate a gif when they themselves are already animated?


Is it me or does the article point that out itself?

But kudos on being Fist.


Hang on, doesn't it say that in the article?


Come to think of it, the article mentions the same thing already.


Check out http://thedailywtf.com/Articles/Technically,-Its-Still-GIF-Animation.aspx for an easy alternative to animated GIFs


Thanks! Also, more useful information and links can be found at http://thedailywtf.com/Comments/Technically,-Its-Still-GIF-Animation.aspx


Thanks! I was trying to remember where it was I read about this and could only vaguely rememebr a TDWFT article...

Re: Technically, It's Still GIF Animation

2009-03-30 09:45 • by J D (unregistered)
document.getElementById() ? More cycles wasted!


function Animate() {
var img = document.getElementById('Logo');
var async_loop;
var animFrame = 0;
async_loop = function() {
animFrame = animFrame % 6 + 1;
img.src = 'Template/Wait0' + animFrame + '.gif';
setTimeout(async_loop, 200);
};
async_loop();
}


I particularly love that it has no exit condition. Anything that's worth doing, is worth doing FOREVER!

Re: Technically, It's Still GIF Animation

2009-03-30 09:47 • by M C Spanner (unregistered)
252346 in reply to 252330
HVS:
Actually, there is a perfectly good reason to do this. If you have a "report running" page that has been submitted, Firefox will often stop all running animations on the page. This is not a problem in IE. By doing it with javascript, it avoids this problem.


or use the animated gif and re-set the source of the image on submit and it'll keep going

Re: Technically, It's Still GIF Animation

2009-03-30 09:47 • by PSWorx
252347 in reply to 252340
cdosrun:
Check out http://thedailywtf.com/Articles/Technically,-Its-Still-GIF-Animation.aspx for an easy alternative to animated GIFs


A circular reference! :O
I hope the forum's garbage collector can handle that...

Re: Technically, It's Still GIF Animation

2009-03-30 09:51 • by 50% Opacity (unregistered)
252348 in reply to 252344
Ted:
illtiz:
cdosrun:
illtiz:
Bobbo:
illtiz:
LightStyx:
Now for the comment...

here's an easy way around that... just create the gif animation in GIMP as one file then stick it in there. Why would one need programming to animate a gif when they themselves are already animated?


Is it me or does the article point that out itself?

But kudos on being Fist.


Hang on, doesn't it say that in the article?


Come to think of it, the article mentions the same thing already.


Check out http://thedailywtf.com/Articles/Technically,-Its-Still-GIF-Animation.aspx for an easy alternative to animated GIFs


Thanks! Also, more useful information and links can be found at http://thedailywtf.com/Comments/Technically,-Its-Still-GIF-Animation.aspx


Thanks! I was trying to remember where it was I read about this and could only vaguely rememebr a TDWFT article...


So you won't have to search long, I think this comment sums it up pretty nicely: http://thedailywtf.com/Comments/Technically,-Its-Still-GIF-Animation.aspx#252324

Re: Technically, It's Still GIF Animation

2009-03-30 09:56 • by Smash King
252349 in reply to 252344
Ted:
illtiz:
cdosrun:
illtiz:
Bobbo:
illtiz:
LightStyx:
Now for the comment...

here's an easy way around that... just create the gif animation in GIMP as one file then stick it in there. Why would one need programming to animate a gif when they themselves are already animated?


Is it me or does the article point that out itself?

But kudos on being Fist.


Hang on, doesn't it say that in the article?


Come to think of it, the article mentions the same thing already.


Check out http://thedailywtf.com/Articles/Technically,-Its-Still-GIF-Animation.aspx for an easy alternative to animated GIFs


Thanks! Also, more useful information and links can be found at http://thedailywtf.com/Comments/Technically,-Its-Still-GIF-Animation.aspx


Thanks! I was trying to remember where it was I read about this and could only vaguely rememebr a TDWFT article...
And there's another useful option in that article's comments, posted by LightStyx (IIRC).

Re: Technically, It's Still GIF Animation

2009-03-30 09:58 • by illvm (unregistered)
TRWTF is they are using eval in the setTimeout() function. Instead of calling setTimeout("Animate()", 200) they should be calling setTimeout(Animate, 200). Oh... and using globals... and not caching the img element... and in the first version not using switch case. Maybe the original code was to support animated PNGs in a browser that *still* doesn't support them.

Re: Technically, It's Still GIF Animation

2009-03-30 09:58 • by mbvlist
252351 in reply to 252347
PSWorx:
cdosrun:
Check out http://thedailywtf.com/Articles/Technically,-Its-Still-GIF-Animation.aspx for an easy alternative to animated GIFs


A circular reference! :O
I hope the forum's garbage collector can handle that...


I see a lot of garbage in the comments, so I assume it's broken anyway

Re: Technically, It's Still GIF Animation

2009-03-30 10:00 • by Ted (unregistered)
252352 in reply to 252349
Smash King:
Ted:
illtiz:
cdosrun:
illtiz:
Bobbo:
illtiz:
LightStyx:
Now for the comment...

here's an easy way around that... just create the gif animation in GIMP as one file then stick it in there. Why would one need programming to animate a gif when they themselves are already animated?


Is it me or does the article point that out itself?

But kudos on being Fist.


Hang on, doesn't it say that in the article?


Come to think of it, the article mentions the same thing already.


Check out http://thedailywtf.com/Articles/Technically,-Its-Still-GIF-Animation.aspx for an easy alternative to animated GIFs


Thanks! Also, more useful information and links can be found at http://thedailywtf.com/Comments/Technically,-Its-Still-GIF-Animation.aspx


Thanks! I was trying to remember where it was I read about this and could only vaguely rememebr a TDWFT article...
And there's another useful option in that article's comments, posted by LightStyx (IIRC).


...or old faithful google yields some good results (first listing)

Re: Technically, It's Still GIF Animation

2009-03-30 10:08 • by another guy (unregistered)
252353 in reply to 252330
Is it Firefox that stops the animations? I thought I had that problem in IE but not Firefox. It has been a while though.

Re: Technically, It's Still GIF Animation

2009-03-30 10:10 • by notromda
252354 in reply to 252342
illtiz:
cdosrun:
illtiz:
Bobbo:
illtiz:
LightStyx:
Now for the comment...

here's an easy way around that... just create the gif animation in GIMP as one file then stick it in there. Why would one need programming to animate a gif when they themselves are already animated?


Is it me or does the article point that out itself?

But kudos on being Fist.


Hang on, doesn't it say that in the article?


Come to think of it, the article mentions the same thing already.


Check out http://thedailywtf.com/Articles/Technically,-Its-Still-GIF-Animation.aspx for an easy alternative to animated GIFs


Thanks! Also, more useful information and links can be found at http://thedailywtf.com/Comments/Technically,-Its-Still-GIF-Animation.aspx


Be careful with the code in that link - the whole thing could have been replaced by an animated gif.

Re: Technically, It's Still GIF Animation

2009-03-30 10:10 • by Wyrd (unregistered)
252355 in reply to 252334
Run This:
HVS:
Actually, there is a perfectly good reason to do this. If you have a "report running" page

Remind me again why we need that cute dancing cartoon? Oh yeah it is to reassure the timid little untrainable luser that his precious report is still running. Even if it isn't. Damn lying GUI designers. Hey but at least it's colorful.

Yeah, I'm with you. If you're gonna go to all the trouble of a progress bar or a "working..." message, it oughta be at least loosely tied to the actual progress of the process. That way it's not lying. The article links to a site that will create animated gifs of false progress indicators.

The animatied gif progress indicators... they do nothing!

--
Furry cows moo and decompress.

Re: Technically, It's Still GIF Animation

2009-03-30 10:16 • by justsomedude (unregistered)
Cognos BI?

Re: Technically, It's Still GIF Animation

2009-03-30 10:17 • by J D (unregistered)
252357 in reply to 252350
illvm:
Maybe the original code was to support animated PNGs in a browser that *still* doesn't support them.


Or animated JPEGs! As a low-tech alternative to embedded video. 5 frames per second!

illvm:
TRWTF is they are using eval in the setTimeout() function


I'd agree that it's a bad idea, but probably the overhead is negligible, and modern JS implementations will optimise it away for you. Not really a WTF in itself.

I'd say TRWTF is that they're not using an array of image filenames or at least clearly defined bounds in the original version: adding a frame in the original would mean adding two lines, which probably did happen at some point. It's pretty odd that each cycle lasts exactly 6/5 of a second.

Re: Technically, It's Still GIF Animation

2009-03-30 10:24 • by HVS (unregistered)
252358 in reply to 252346
M C Spanner:
or use the animated gif and re-set the source of the image on submit and it'll keep going


I didn't know that. I'll have to give it a try. Thanks.

Re: Technically, It's Still GIF Animation

2009-03-30 10:30 • by Andy Goth
252359 in reply to 252323
Addison:
*claps slowly*
You mean, like this?

Re: Technically, It's Still GIF Animation

2009-03-30 10:31 • by diaphanein (unregistered)
252360 in reply to 252333
whatever:
LightStyx:
First...


LightStyx:
Now for the comment...

here's an easy way around that... just create the gif animation in GIMP as one file then stick it in there. Why would one need programming to animate a gif when they themselves are already animated?


O....M......G......!!!!

You submit a 'first post' which is soooo lame it's ludicrous, and then 4 minutes later post a comment that is spelled out right there in the article.

Wow.
agreed. +1 fail.

Re: Technically, It's Still GIF Animation

2009-03-30 10:33 • by Mr B
252361 in reply to 252324
LightStyx:
Now for the comment...

here's an easy way around that... just create the gif animation in GIMP as one file then stick it in there. Why would one need programming to animate a gif when they themselves are already animated?


Obvious troll...is obvious.

Re: Technically, It's Still GIF Animation

2009-03-30 10:33 • by Anonymouse (unregistered)
Google actually does exactly this for those little animated emoticons you get in GMail Chat. Maybe there's a reason ...?

Re: Technically, It's Still GIF Animation

2009-03-30 10:33 • by Ken B (unregistered)
252363 in reply to 252329
Zhango!:
...but I have animated GIFs shut off in my browser, so there!

Which reminds me, he forgot the code for what to do if JavaScript is shut off.
Well that's simple enough. Just use
if ( javascriptEnabled() )

Re: Technically, It's Still GIF Animation

2009-03-30 10:36 • by SR (unregistered)
252364 in reply to 252359
Nice effet! Care to share the code?

Re: Technically, It's Still GIF Animation

2009-03-30 10:41 • by waldo (unregistered)
252365 in reply to 252339
jspenguin:
I see the WTF. They're passing a string to setTimeout. They should pass a function object, so it doesn't have to recompile the code every 200 ms:
setTimeout(Animate, 200)
Or, even better, they could call setInterval once and it will automatically reschedule the timer.

I hate when people don't take the time to read the API documentation.

Actually, there's a pretty good reason not to use setInterval http://ejohn.org/blog/how-javascript-timers-work/

other than that, it would have only made sense if it was using a single image containing several sprites for the animation, otherwise, it's a WTF however you rewrite it (like they did on http://thedailywtf.com/Comments/Technically,-Its-Still-GIF-Animation.aspx)

Re: Technically, It's Still GIF Animation

2009-03-30 11:00 • by pjt33
252368 in reply to 252359
Andy Goth, how did you embed the JavaScript to do that animation?

Re: Technically, It's Still GIF Animation

2009-03-30 11:00 • by Fast Eddie (unregistered)
I prefer to use animated JPEGs. The compression is better and the transition more seamless.

Re: Technically, It's Still GIF Animation

2009-03-30 11:00 • by JG (unregistered)
There seems to be more WTF's in the comments then there were in the article :S

Re: Technically, It's Still GIF Animation

2009-03-30 11:06 • by lol (unregistered)
252371 in reply to 252333
whatever:
LightStyx:
First...


LightStyx:
Now for the comment...

here's an easy way around that... just create the gif animation in GIMP as one file then stick it in there. Why would one need programming to animate a gif when they themselves are already animated?


O....M......G......!!!!

You submit a 'first post' which is soooo lame it's ludicrous, and then 4 minutes later post a comment that is spelled out right there in the article.

Wow.


Spoiler: LightStyx is a troll the likes of which we haven't seen since TopCod3r

Re: Technically, It's Still GIF Animation

2009-03-30 11:18 • by Jim (unregistered)
252372 in reply to 252370
WTF attract WTF...
« PrevPage 1 | Page 2 | Page 3Next »

Add Comment