Longcat demo

This commit is contained in:
Brian Anderson 2013-09-11 22:03:39 -07:00
parent 42c6a53148
commit db38639c17
5 changed files with 33 additions and 0 deletions

View file

@ -0,0 +1,10 @@
<html>
<head>
</head>
<body>
<p><img src="longcattop.png"/></p>
<p><img src="longcatmid.png"/></p>
<p><img src="longcatbot.png"/></p>
<script src="longcat.js"></script>
</body>
</html>

23
src/test/html/longcat.js Normal file
View file

@ -0,0 +1,23 @@
var longcats = window.document.getElementsByTagName("img");
var longcat_top = longcats[0];
var longcat_mid = longcats[1];
var longcat_bot = longcats[2];
function wait_for_img_load(f) {
if (longcat_top.width != 0 && longcat_mid.width != 0 && longcat_bot.width != 0) {
f();
} else {
window.setTimeout(function() { wait_for_img_load(f) }, 1);
}
}
wait_for_img_load(function() {
var count = 0;
function elongate() {
let height = Math.round((Math.sin(count) + 1) * 70 + 20);
count += 0.2;
longcat_mid.height = height;
window.setTimeout(function() { elongate() }, 100);
}
elongate();
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB