Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #39225
| Newsgroups | comp.lang.javascript |
|---|---|
| Subject | Re: Great animation, that you all may like. |
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
| References | <f9689b96-2a84-42e3-9d26-cb687c41b4d0n@googlegroups.com> |
| Date | 2020-12-05 16:04 +0100 |
| Message-ID | <XnsAC8AA3940F6BFeejj99@194.109.6.166> (permalink) |
Chrictjan Robam <he12457@hotmail.com> wrote on 05 Dec 2020 in
comp.lang.javascript:
> <html>
> <head>
> <style>
> body {
> height: 100%;
> color:green;
> background-color: black;
>}
>#a1 {
> width: 100vw;
> height: 100%;
> font-size: 6vw;
> font-weight: bold;
> overflow-y:hidden;
> line-height:5vw;
>
>}
>#aaa1 {
> line-height:5vw;
>}
> </style>
> </head>
> <body>
>
> <div id="a1">
> </div>
> <script>
> var next=0;
> var next01="";
> function a2() {
> setInterval(function(){
> var a=Math.round(Math.random()*99999);
> var aa=document.getElementById("a1").innerHTML;
> var aa1=document.body.clientWidth;
> var aa2=Math.round(aa1/64);
> if(aa.length>2100000) aa="";
> if(next<aa2) {
> next01=a+" "+next01;
> next++;
> }
> if(next==aa2) {
> document.getElementById("a1").innerHTML="<div
> id='aaa1'>"+next01+"</div>"+aa; next=0;
> next01="";
> }
>
> }, 1);
>}
>
> a2();
> </script>
> </body>
> </html>
There is a lot of unnecessary code like the looping,
making the interval dependent on the size.
Try this:
=========================
<html>
<head>
<style>
body {
color:white;
background-color: black;
font-size: 3vw;
font-weight: bold;
line-height:5vw;
}
</style>
<script>
const f = () => {
let inner = '';
let count = 0;
while (count < 6 * 6) {
inner += ' ' + Math.floor(Math.random()*99999);
count++;
if (count % 6 == 0) inner += '<br>';
};
document.body.innerHTML = inner;
};
window.onload = setInterval(f, 100);
</script>
</head>
<body></body>
</html>
=========================
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Great animation, that you all may like. Chrictjan Robam <he12457@hotmail.com> - 2020-12-05 03:37 -0800
Re: Great animation, that you all may like. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-12-05 16:04 +0100
Re: Great animation, that you all may like. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-12-05 16:54 +0100
Re: Great animation, that you all may like. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-12-05 16:56 +0100
Re: Great animation, that you all may like. Chrictjan Robam <he12457@hotmail.com> - 2020-12-06 02:19 -0800
Re: Great animation, that you all may like. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-12-06 16:16 +0100
Re: Great animation, that you all may like. Chrictjan Robam <he12457@hotmail.com> - 2020-12-06 09:55 -0800
Re: Great animation, that you all may like. I I <he12457@hotmail.com> - 2021-01-09 08:56 -0800
Re: Great animation, that you all may like. I I <kpuctjanpobam@mail.com> - 2021-01-09 13:03 -0800
Re: Great animation, that you all may like. I I <kpuctjanpobam@mail.com> - 2021-01-09 13:11 -0800
csiph-web