Osvaldo Hernandez
asked on
need information about :Accepted Solution by:WilkodJ ID: 9335141 2003-09-11
I found this code very helpfull for my church site, but i would like to know if can add a loop so it repeat itself. Thank you
<html>
<head>
<script>
var updateRate = 50; // Lower number gives higher update rate
var sizeChange = 0.25; // Lower number gives smaller difference in fontsize per update
var numberOfLines = 24; // Set this to the number of lines
</script>
<style>
.vline {font-size: 0; margin: 0}
.line {font-size: 0; margin: 0; display: none}
</style>
</head>
<body bgcolor="black" text="white" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" scroll="no">
<div style="position: absolute; left: -100%; top: 20%; width: 300%; height: 80%; overflow: hidden; text-align: center">
<p id="p0" class="line"> </p>
<p id="p1" class="line"> </p>
<p id="p2" class="line"> </p>
<p id="p3" class="line"> </p>
<p id="p4" class="line"> </p>
<p id="p5" class="line"> </p>
<p id="p6" class="line"> </p>
<p id="p7" class="line">All lines about the same length</p>
<p id="p8" class="line">Gives the best result I believe</p>
<p id="p9" class="line">All lines about the same length</p>
<p id="p10" class="line">Gives the best result I believe</p>
<p id="p11" class="line">All lines about the same length</p>
<p id="p12" class="line">Gives the best result I believe</p>
<p id="p13" class="line">All lines about the same length</p>
<p id="p14" class="line">Gives the best result I believe</p>
<p id="p15" class="line">All lines about the same length</p>
<p id="p16" class="line">Gives the best result I believe</p>
<p id="p17" class="line">All lines about the same length</p>
<p id="p18" class="line">Gives the best result I believe</p>
<p id="p19" class="line">All lines about the same length</p>
<p id="p20" class="line">Gives the best result I believe</p>
<p id="p21" class="line">All lines about the same length</p>
<p id="p22" class="line">Gives the best result I believe</p>
<p id="p23" class="line">All lines about the same length</p>
</div>
<script>
var ti, cnt, fv = 0;
function handler()
{
// sz -> fontsize in (pt)
// i -> paragraph id counter
var i, sz;
// cnt ->
cnt++;
if (fv >= numberOfLines) clearInterval(ti);
var mx = fv+8;
if (mx >= numberOfLines) mx = numberOfLines;
for (i = fv; i < mx; i++)
{
sz = -cnt*sizeChange + i * 10;
if (sz <= 0)
{
fv = i + 1;
document.all("p" + i).className = "line";
}
else if (sz <= 80)
{
document.all("p" + i).style.fontSize = sz + "pt";
document.all("p" + i).className = "vline";
}
}
}
function init()
{
document.all.p4.className = "vline";
cnt = 0;
ti = setInterval("handler()", updateRate );
}
init();
</script>
</body>
</html>
<html>
<head>
<script>
var updateRate = 50; // Lower number gives higher update rate
var sizeChange = 0.25; // Lower number gives smaller difference in fontsize per update
var numberOfLines = 24; // Set this to the number of lines
</script>
<style>
.vline {font-size: 0; margin: 0}
.line {font-size: 0; margin: 0; display: none}
</style>
</head>
<body bgcolor="black" text="white" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" scroll="no">
<div style="position: absolute; left: -100%; top: 20%; width: 300%; height: 80%; overflow: hidden; text-align: center">
<p id="p0" class="line"> </p>
<p id="p1" class="line"> </p>
<p id="p2" class="line"> </p>
<p id="p3" class="line"> </p>
<p id="p4" class="line"> </p>
<p id="p5" class="line"> </p>
<p id="p6" class="line"> </p>
<p id="p7" class="line">All lines about the same length</p>
<p id="p8" class="line">Gives the best result I believe</p>
<p id="p9" class="line">All lines about the same length</p>
<p id="p10" class="line">Gives the best result I believe</p>
<p id="p11" class="line">All lines about the same length</p>
<p id="p12" class="line">Gives the best result I believe</p>
<p id="p13" class="line">All lines about the same length</p>
<p id="p14" class="line">Gives the best result I believe</p>
<p id="p15" class="line">All lines about the same length</p>
<p id="p16" class="line">Gives the best result I believe</p>
<p id="p17" class="line">All lines about the same length</p>
<p id="p18" class="line">Gives the best result I believe</p>
<p id="p19" class="line">All lines about the same length</p>
<p id="p20" class="line">Gives the best result I believe</p>
<p id="p21" class="line">All lines about the same length</p>
<p id="p22" class="line">Gives the best result I believe</p>
<p id="p23" class="line">All lines about the same length</p>
</div>
<script>
var ti, cnt, fv = 0;
function handler()
{
// sz -> fontsize in (pt)
// i -> paragraph id counter
var i, sz;
// cnt ->
cnt++;
if (fv >= numberOfLines) clearInterval(ti);
var mx = fv+8;
if (mx >= numberOfLines) mx = numberOfLines;
for (i = fv; i < mx; i++)
{
sz = -cnt*sizeChange + i * 10;
if (sz <= 0)
{
fv = i + 1;
document.all("p" + i).className = "line";
}
else if (sz <= 80)
{
document.all("p" + i).style.fontSize = sz + "pt";
document.all("p" + i).className = "vline";
}
}
}
function init()
{
document.all.p4.className = "vline";
cnt = 0;
ti = setInterval("handler()", updateRate );
}
init();
</script>
</body>
</html>
ASKER
Thanks for your attention, I am looking to insert a loop in the star wars script so it can repeat automatic
Thanks again
<html>
<head>
<script>
var updateRate = 50; // Lower number gives higher update rate
var sizeChange = 0.25; // Lower number gives smaller difference in fontsize per update
var numberOfLines = 24; // Set this to the number of lines
</script>
<style>
.vline {font-size: 0; margin: 0}
.line {font-size: 0; margin: 0; display: none}
</style>
</head>
<body bgcolor="black" text="white" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" scroll="no">
<div style="position: absolute; left: -100%; top: 20%; width: 300%; height: 80%; overflow: hidden; text-align: center">
<p id="p0" class="line"> </p>
<p id="p1" class="line"> </p>
<p id="p2" class="line"> </p>
<p id="p3" class="line"> </p>
<p id="p4" class="line"> </p>
<p id="p5" class="line"> </p>
<p id="p6" class="line"> </p>
<p id="p7" class="line">All lines about the same length</p>
<p id="p8" class="line">Gives the best result I believe</p>
<p id="p9" class="line">All lines about the same length</p>
<p id="p10" class="line">Gives the best result I believe</p>
<p id="p11" class="line">All lines about the same length</p>
<p id="p12" class="line">Gives the best result I believe</p>
<p id="p13" class="line">All lines about the same length</p>
<p id="p14" class="line">Gives the best result I believe</p>
<p id="p15" class="line">All lines about the same length</p>
<p id="p16" class="line">Gives the best result I believe</p>
<p id="p17" class="line">All lines about the same length</p>
<p id="p18" class="line">Gives the best result I believe</p>
<p id="p19" class="line">All lines about the same length</p>
<p id="p20" class="line">Gives the best result I believe</p>
<p id="p21" class="line">All lines about the same length</p>
<p id="p22" class="line">Gives the best result I believe</p>
<p id="p23" class="line">All lines about the same length</p>
</div>
<script>
var ti, cnt, fv = 0;
function handler()
{
// sz -> fontsize in (pt)
// i -> paragraph id counter
var i, sz;
// cnt ->
cnt++;
if (fv >= numberOfLines) clearInterval(ti);
var mx = fv+8;
if (mx >= numberOfLines) mx = numberOfLines;
for (i = fv; i < mx; i++)
{
sz = -cnt*sizeChange + i * 10;
if (sz <= 0)
{
fv = i + 1;
document.all("p" + i).className = "line";
}
else if (sz <= 80)
{
document.all("p" + i).style.fontSize = sz + "pt";
document.all("p" + i).className = "vline";
}
}
}
function init()
{
document.all.p4.className = "vline";
cnt = 0;
ti = setInterval("handler()", updateRate );
}
init();
</script>
</body>
</html>
Thanks again
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
And what is your question? Please put any code in a code block