Animations without JS...or CSS...or IMAGES??!? 😲 Pure HTML animation!
Tags: showdev, webdev, php, html
Published: 2021-04-16 17:31:02

I recently created [a countdown timer that used no JS, CSS or HTML.](https://dev.to/inhuofficial/this-gif-is-accurate-to-within-a-minute-how-to-create-a-dynamic-gif-countdown-3fhd)

Then I went one better and built [a password generator in pure CSS (no JS!)](https://dev.to/inhuofficial/a-pure-css-password-generator-they-said-it-can-t-be-done-4pla)

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!**](https://inhu.co/demos/ascii-animation/1.php) (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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/92m9krldi4krb9ec0kuh.jpg)

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](https://en.wikipedia.org/wiki/Netscape_Navigator) - 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!