mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Longcat demo
This commit is contained in:
parent
42c6a53148
commit
db38639c17
5 changed files with 33 additions and 0 deletions
10
src/test/html/longcat.html
Normal file
10
src/test/html/longcat.html
Normal 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
23
src/test/html/longcat.js
Normal 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();
|
||||
});
|
BIN
src/test/html/longcatbot.png
Normal file
BIN
src/test/html/longcatbot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
src/test/html/longcatmid.png
Normal file
BIN
src/test/html/longcatmid.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 329 B |
BIN
src/test/html/longcattop.png
Normal file
BIN
src/test/html/longcattop.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
Loading…
Add table
Add a link
Reference in a new issue