Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > alt.comp.programming > #58
| Newsgroups | alt.comp.programming |
|---|---|
| Date | 2020-08-24 07:22 -0700 |
| Message-ID | <449fb66b-7d27-4ca4-b903-327d8a2f7e85o@googlegroups.com> (permalink) |
| Subject | Random pixels on a square animation. PHP. |
| From | he12457@hotmail.com |
2 files: rbmp.php and index.php.
rbmp.php:
<style>
body {
font-size: 1px;
line-height:4px;
}
.a1 {
display: inline-block;
width:4px;
height:4px;
}
</style>
<?php
for($i=0; $i<20; $i++) {
for($j=0; $j<20; $j++) {
$randomcolor = '#'.dechex(rand(0,10000000));
echo "<div class='a1' style='background-color: ".$randomcolor.";'> </div>";
}
echo "<br>";
}
?>
index.php:
<html>
<head>
<style>
#anim {
width:100px;
height:100px;
transform: scale(6);
transform-origin: 0% 0% 0px;
}
</style>
</head>
<body>
<div id="anim">
</div>
<script>
function renewing() {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == XMLHttpRequest.DONE) {
if (xmlhttp.status == 200) {
document.getElementById("anim").innerHTML = xmlhttp.responseText;
}
else if (xmlhttp.status == 400) {
alert('Error 400');
}
else {
alert('Not 200 returned');
}
}
};
var d765=new Date();
xmlhttp.open("GET", "rbmp.php?d="+d765, false);
xmlhttp.setRequestHeader('Cache-Control', 'no-cache');
xmlhttp.send();
}
function rerun() {
setTimeout(function() {
renewing();
rerun();
}, 100);
}
rerun();
</script>
</body>
</html>
Created by: Kristjan Robam
he12457 @ hot mail . c o m
+372 6861327
Back to alt.comp.programming | Previous | Next | Find similar
Random pixels on a square animation. PHP. he12457@hotmail.com - 2020-08-24 07:22 -0700
csiph-web