DEV Community

Cover image for Animations without JS...or CSS...or IMAGES??!? ๐Ÿ˜ฒ Pure HTML animation!
GrahamTheDev
GrahamTheDev

Posted on • Updated on

Animations without JS...or CSS...or IMAGES??!? ๐Ÿ˜ฒ Pure HTML animation!

I recently created a countdown timer that used no JS, CSS or HTML.

Then I went one better and built a password generator in pure CSS (no JS!)

But now I have gone even more insane!

I present to you an animation that doesn't use any images....

An animation that doesn't use any CSS...

An animation that doesn't use any JavaScript....

It is all done with pure HTML!

Warning: If you experience epilepsy, motion sensitivity (vestibular disorders) or are using a screen reader, you probably shouldn't click the link....yet again this is a silly experiment that should never be used in the real world and unfortunately is not accessible!)

Click here to experience it in all of it's glory! (sorry I can't make it work on dev.to!)

Spoilers lie below so make sure you click the link and see it in action before scrolling down!

.
.
.
.
.
.
.
Spoilers in
.
.
.
.
.
.
3
.
.
.
.
.
.
2
.
.
.
.
.
.
1
.
.
.
.
.
.

Spoilers!

Rick Roll in ASCII text

Yes I did just Rick Roll you with ASCII text!

I title the piece "Rick ASCII-ly" (groan) ๐Ÿคฃ

So what is going on?

There are 44 pages each with a different "frame" of our ASCII video.

Each frame is then set to automatically load the next page using <meta http-equiv="refresh" content="0; URL = {next page URL}">

The last page then points to the first page to create an infinite loop!

1.php -> 2.php -> [...] -> 44.php -> 1.php and the loop continues.

By setting the delay to 0 on the meta refresh, and with a fast enough connection (or when all the images are cached locally), it actually performs reasonably well (in fact it is a little bit too quick!)....it is just a shame I can't play audio as well in pure HTML!

How did you create the frames?

I used an online tool (Edit: sadly it no longer exists since writing this article, but I am sure there are others) to convert a GIF to each frame of ASCII art.

Then I just copied the ASCII text into a <pre> element for each of the pages and set the redirect to the next frame programmatically.

Note that although the file extension is .php this would still work with .html files. There is no server side magic going on here, I just had the files as PHP during testing so I could run some checks and never changed it.

FireFox

If you viewed it in Chrome originally you should also view it in FireFox, they seem to try and interpret the symbols with syntax highlighting (as they are displayed within a <pre> tag) so you get some (strange) colour for free!

Compatibility

This works all the way back to Netscape Navigator 1.1 - it is the most compatible animation format in the world! - I wonder if "caniuse" will add it to their database? ๐Ÿ˜‹๐Ÿคฃ

Why?

Does it have any practical uses? no.

Did it get me locked out of my server as it triggered Mod Sec with too many requests? Absolutely!

Is it a bit of fun on a Friday? Yes

So happy weekend people, you got rick rolled with ASCII text so I win the internet for today ๐Ÿคฃ!

Leave a comment if you hate me for this!

Oh and don't be afraid of sharing it on social media - I want to see if my server can cope with thousands of requests a second ๐Ÿ˜ - a free stress test woohoo!

Top comments (42)

Collapse
 
grahamthedev profile image
GrahamTheDev

I don't know why I am so proud of myself for using a 15 year old meme....I think it is the sheer effort converting the video to ASCII text that did it and the hour remembering how to get past Mod Sec when I locked myself out of my server that did it.

@afif I am so sorry to do the no CSS thing to you again bud!

Collapse
 
0vortex profile image
TED Vortex (Teodor Eugen Duศ›ulescu)

loving your clickbait, I'm sure they attract the best possible audiences

Collapse
 
grahamthedev profile image
GrahamTheDev • Edited

The title might have the clickbait style but it isn't clickbait if you tell the truth and deliver on your promise surely? ๐Ÿ˜‹๐Ÿ˜‚

As for attracting the best audiences, you are here so I would say I most certainly do attract the best people ๐Ÿ˜‰โค

Collapse
 
0vortex profile image
TED Vortex (Teodor Eugen Duศ›ulescu)

you could have just gotten the cue btw but this just proves to show you know EXACTLY what you are doing.

Thread Thread
 
grahamthedev profile image
GrahamTheDev

You should perhaps check out the other items in the series, there is only one where the title is a little bit misleading and that was due to character count and I expand upon that in the first paragraph (dev.to/inhuofficial/is-0kb-of-html...).

As for knowing what I was doing I cannot tell if you are being ironic or not in writing so I gave you the benefit of the doubt.

The only clickbait titles I have are the two recent ones on listicles, and I am sure if you like irony and silliness you would love them as they are pure sarcasm!

Collapse
 
0vortex profile image
TED Vortex (Teodor Eugen Duศ›ulescu)

I was ironic, it's not HTML it's PHP ... hence the clickbait.

Thread Thread
 
grahamthedev profile image
GrahamTheDev • Edited

It is just a .php extension - check the outputted HTML it is indeed just a load of HTML, it would work equally well with a .html extension.

It uses <meta http-equiv="refresh" content="0;url={next frame}" /> meta tag to request the next frame (which is stored on an individual URL), then after a certain amount of frames it just requests the first frame again ([...]1.php).

Each frame is just HTML. If you open it on a PC you will see the URL changes rapidly. No PHP trickery I promise!

Collapse
 
adam_cyclones profile image
Adam Crockett ๐ŸŒ€

SVG SMIL it's animation without CSS or JavaScript

Collapse
 
grahamthedev profile image
GrahamTheDev • Edited

SVG is an image format...so that would be animation without CSS or JS - in which case I could also have just used a GIF ๐Ÿ˜‹

The article was pure HTML animation!

Collapse
 
adam_cyclones profile image
Adam Crockett ๐ŸŒ€

SVG is made of XML so is html so by the transit of properties ๐Ÿค” we are all winning here

Thread Thread
 
grahamthedev profile image
GrahamTheDev

That is XHTML if we are going to try and squeeze it in (which never quite took off). I could make the document HTML 4 and then get away with it, but HTML != XML due to the fact you can declare a void element like this <br> or <hr> - that would break XML as it isn't self-closed!

SVG is also a separate spec to HTML so I don't think I could get away with it without it being clickbait!

However using SVG SMIL is going to be another part of this series of silly experiments with "clickbait" titles that turn out to not be clickbait! ๐Ÿ˜‰.

Thread Thread
 
adam_cyclones profile image
Adam Crockett ๐ŸŒ€

On the subject of clickbait titles.

Do X in Y time

X things you wouldn't Y

That's the magic right there ๐Ÿคฃ

Thread Thread
 
grahamthedev profile image
GrahamTheDev • Edited

I am practicing my clickbait titles - see if you like any of these (these are actual articles I am working on, just made the titles pure clickbait for you! ๐Ÿคฃ)

  • I downloaded every article on dev.to [246000 articles!] - here is what I learned (I actually did download every article - 9.3GB without images!)
  • Sorry guys, the results are in and SIZE DOES MATTER. (byte efficiency article)
  • A website without a single line of HTML? (part of this series!)
  • GDPR and cookie consent are making things LESS private (the new Google spying they are trialing)
  • 10 useful HTML elements your probably don't know (with a bonus one of course!)
  • The secret to a happy website is good <HEAD> (preloading etc.)

A couple of them might be a little too far ๐Ÿคฃ๐Ÿคฃ

Collapse
 
ingosteinke profile image
Ingo Steinke, web developer

Hi Graham, I clicked on your link before reading the spoiler, saw the artwork and started to understand ... and had to laugh out loud! Nice surprise! no wonder it does not work on dev.to though. Have a nice weekend!

Collapse
 
grahamthedev profile image
GrahamTheDev

Haha thanks Ingo, I hope you have a great weekend too!

Collapse
 
rplantiko profile image
Rรผdiger Plantiko

I like to be rickrolled this way! ๐Ÿ˜‰

btw: for developers, the words "ASCII" or "plain text" will never sound backward or retarded - as they do for the hipsters - but they will always feel like "the real thing".

Collapse
 
grahamthedev profile image
GrahamTheDev

As long as it brought a smile to your face then it did itโ€™s job! ๐Ÿ˜„

 
grahamthedev profile image
GrahamTheDev

It is one of those projects where you โ€œdo it badlyโ€ and then see how many clever algorithms etc a real codec uses and learn loads....added it for about 3 posts from now as I think it would be fun!

Thanks for the idea ๐Ÿ˜„

Collapse
 
thalitadev profile image
Thalita G.

Your posts lately have been having me like...

inhu

(jk I love you)

Collapse
 
grahamthedev profile image
GrahamTheDev

That picture is awesome!

Glad my posts are inspiring strong feelings...they always say there is a fine line between love and hate ๐Ÿคฃ๐Ÿคฃ๐Ÿคฃ๐Ÿคฃ lets hope I stay on the right side of that line ๐Ÿ˜œ

Collapse
 
grahamthedev profile image
GrahamTheDev

I couldn't check it last night - it is 2.5kb per frame when gzipped for a 200 by 60 "resolution" image.

So it looks like you are right, I won't be able to roll this out as the future of video bandwidth saving ideas!

However you have given me an idea for a fun experiment for trying to write an "ASCII codec"....but that might be beyond my skills ๐Ÿคฃ

Collapse
 
grahamthedev profile image
GrahamTheDev

Haha, with gzipping I would imagine the bandwidth usage is quite low ๐Ÿ˜œ๐Ÿคฃ๐Ÿคฃ

Collapse
 
12944qwerty profile image
12944qwerty

How long did it take to you to make every single frame? And how did you get enough patience? Just... wow!!!

Collapse
 
grahamthedev profile image
GrahamTheDev • Edited

I automated it - you can split a gif easily online into frames. Then I just used canvas to turn the frame grey and apply letters depending on the lightness / darkness of a square.

The only manual part was copying the text into a page as I couldnโ€™t think of a way to automate that quicker than just copy and pasting.

Collapse
 
12944qwerty profile image
12944qwerty

Did you apply each letter by hand? Or did you make a program to detect that...

Thread Thread
 
grahamthedev profile image
GrahamTheDev

Oh god know - the program had 8 characters to choose from that represented different darknesses for pixels. So a # is darker than a ( for example. It then just spit out a 200 by 60 string that I could copy and paste into a <pre> tag so it was evenly spaced

Collapse
 
myleftshoe profile image
myleftshoe

Sure to be the next standard for web video! For some reason it reminds me of another 80s "icon" Samamtha Fox in the Commodore 64 game Samantha Fox Strip Poker. At least yours has motion.

Collapse
 
grahamthedev profile image
GrahamTheDev

Well I can understand how you could associate the two - Rick Astley is just that sexy that he is bound to remind you of Samantha Fox ๐Ÿคฃ๐Ÿคฃ๐Ÿคฃ๐Ÿคฃ

And I totally agree - if all video was like this on the web I am sure the world would be a better place ๐Ÿ˜‹

Collapse
 
theriusblackers profile image
Arturo Gamboa

Wow! it's surprising, funny, and extremely good. I didn't really understand it at first, then I saw how it worked and I started to laugh internally hehe ... obviously it won't run in dev.to XD

Collapse
 
grahamthedev profile image
GrahamTheDev

If it made you smile then job done! Itโ€™s not immediately obvious as it is abusing the hell out of my server so nobody would normally do this to themselves ๐Ÿคฃ๐Ÿคฃ๐Ÿคฃ

Collapse
 
afif profile image
Temani Afif

After 10 years of research we finally found the ancestor of Youtube. You should publish this as a scientific paper ๐Ÿ˜œ

Collapse
 
grahamthedev profile image
GrahamTheDev

Haha! Brilliant, made me chuckle! Have a great weekend!

Collapse
 
sywill profile image
William long II

Could load the animations in an iframe and add audio tag to get audio to play and still be pure html. I would think.

Collapse
 
grahamthedev profile image
GrahamTheDev • Edited

I did think this, in the brief test I did though it appeared the iframe did not like so many redirects, I might have a fiddle at some point and see if it was just a symptom of mod sec or something!

I suppose the issue is I then technically have 2 copyrighted works on my website ๐Ÿ˜œ

Collapse
 
12944qwerty profile image
12944qwerty

I knew exactly what was about to happen before I clicked the link.... just the way you had put it there made it like that.