Writing text on whole page
I had an idea to repeat same code as I saw on the internet few days ago. It looked like this: On whole screen there were numbers like 0 and 1 (binary system) and those numbers constantly changed value from 0 to 1 and reverse. It was fast but not lighting speed, the speed normal to enjoy the change. I'd like to do that also but when I try to type whole bunch of numbers on the webpage using javascript I just can't find the way. Can anyone help me with that?
Re: Writing text on whole page
Use loops to repeat printing it. Inside it, you could add conditions to swap printing of the 0's or 1's on each iteration. Or you could use the Math.random() function which generates a random number.
You could use it like this on each iteration:
Code:
num = Math.round(Math.random());
Or are you talking about the numbers in the screen fading to another one and viceversa or something like that ? Can you post the link to that page ?
:wave:
Re: Writing text on whole page
It was hacked website of some gouvernment, but now there us nothing. I am not interested in hacking for sure, just wanted to see how to make that effect with javascript. It looked like this:
-Whole page with numbers 0 and 1 .
-Small font-size of those numbers.
-Low opacity of font.
-When website load the numbers start changeing from 0 to 1 and reverse.
I tried random number but all numbers go in same row and keep going forever.
1 Attachment(s)
Re: Writing text on whole page
Instead of using JavaScript for this, we could use an animated gif background! That is, create a gif animated image of 0 transforming to 1. Then, use this as the page background with repeated on both x and y direction.
I have created a demo animated gif using Adobe Imageready (see the attached image).
And the demo html code would look something like this:
HTML Code:
<html>
<head>
<style>
body{background-image: url(01.gif);}
</style>
</head>
</html>
Here's a live demo (probably works for VBF logged in users only): http://jsfiddle.net/w5KLa/
Hope it helps :wave:
Re: Writing text on whole page
Oh ok. But the question I asked here was because I wanted to learn this part with javascript. I know also to do that with Photoshop but thanks again for giving me that idea. Just wanted to see how that work with js.
Re: Writing text on whole page
Hi there Mr.Joker
Here is an example for you to play with....
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="language" content="english">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<title>binary page</title>
<style type="text/css">
html,body {
height:100%;
margin:0;
overflow:hidden;
background-color:#111;
}
#newtable td {
padding:4px;
font-family:'courier new',monospace;
font-size:32px;
color:#eee;
}
</style>
<script type="text/javascript">
function init(){
speed=1500; /* this value is editable */
row=[];
cell=[];
rowNum=40;
cellNum=80;
tab=document.createElement('table');
tab.setAttribute('id','newtable');
tbo=document.createElement('tbody');
for(c=0;c<rowNum;c++){
row[c]=document.createElement('tr');
for(k=0;k<cellNum;k++) {
cell[k]=document.createElement('td');
cont=document.createTextNode(Math.floor(Math.random()*2))
cell[k].appendChild(cont);
row[c].appendChild(cell[k]);
}
tbo.appendChild(row[c]);
}
tab.appendChild(tbo);
document.body.appendChild(tab);
swapnumbers()
}
function swapnumbers() {
cells=document.getElementById('newtable').getElementsByTagName('td');
numbers=cells.length;
for(c=0;c<numbers;c++) {
cells[c].firstChild.nodeValue=Math.floor(Math.random()*2);
}
setTimeout(function(){swapnumbers()},speed);
}
window.addEventListener?
window.addEventListener('load',init,false):
window.attachEvent('onload',init);
</script>
</head>
<body>
<div></div>
</body>
</html>
Re: Writing text on whole page
Thanks man. Wish I can give you both reputation :D .
Re: Writing text on whole page
No problem, you're very welcome. ;)