|
Cole
o código abaixo dentro da tag <body>....</body>
Substitua
o texto em azul, entre aspas, pelo endereço completo da figura
que você deseja usar.
<IMG id=pic0
style="LEFT: -200px; POSITION: absolute; TOP: 0px"
src="mat_abertura_scripts/script_clave.gif"
width="20" height="50"><FONT color=#008080>
<IMG
id=pic1 style="LEFT:
-200px; POSITION: absolute; TOP: 0px"
src="mat_abertura_scripts/script_nota1.gif"
width="13" height="35"> <IMG id=pic2
style="LEFT:
-200px; POSITION: absolute; TOP: 0px"
src="mat_abertura_scripts/script_clave.gif"
width="20" height="50"> <IMG id=pic3
style="LEFT:
-200px; POSITION: absolute; TOP: 0px"
src="mat_abertura_scripts/script_nota2.gif"
width="13" height="40"> <IMG id=pic4
style="LEFT:
-200px; POSITION: absolute; TOP: 0px"
src="mat_abertura_scripts/script_clave.gif"
width="20" height="50"> <IMG id=pic5
style="LEFT:
-200px; POSITION: absolute; TOP: 0px"
src="mat_abertura_scripts/script_nota1.gif"
width="13" height="35"> <IMG id=pic6
style="LEFT:
-200px; POSITION: absolute; TOP: 0px"
src="mat_abertura_scripts/script_nota2.gif"
width="13" height="40"><IMG id=pic7
style="LEFT:
-200px; POSITION: absolute; TOP: 0px"
src="mat_abertura_scripts/script_nota1.gif"
width="13" height="35"> <IMG id=pic8
style="LEFT:
-200px; POSITION: absolute; TOP: 0px"
src="mat_abertura_scripts/script_nota2.gif"
width="13" height="40"> <IMG id=pic9
style="LEFT:
-200px; POSITION: absolute; TOP: 0px"
src="mat_abertura_scripts/script_nota1.gif"
width="13" height="35">
</font>
<p><FONT
color=#008080>
<SCRIPT
language=VBSCRIPT>
REM Edgar V.
Poirier
REM moomoo@nbnet.nb.ca
REM IMPORTANT:
Value in brackets for the arrays below taken from last image
number.
REM The number in
brackets for an array represent the total number of
REM items in the
array. Note that the first item is number 0.
Dim w, wW, wH, an(9),
x(9), y(9), ox(9), oy(9), c(9), cW, cH, sL, sT, numPics, capture
Set w=document.body
REM Initialize
sub setUp()
REM Get window
dimensions
cW=w.clientWidth
cH=w.clientHeight
sL=w.scrollLeft
sT=w.scrollTop
capture=153
REM IMPORTANT:
Enter number of last image here
numPics=9
for i=0 to numPics
randomize
REM Initially none
are bouncing
c(i)=0
REM Number of
pixels to move image per step
ox(i)=4
oy(i)=-4
REM Initial
coordinates
an(i)=3.14159-i
x(i)=Int(COS(an(i))*
50)+70
y(i)=Int(SIN(an(i))*
50)+70
REM Inverta COS e
SIN para giro em sentido contrário
document.all("pic"&i).style.top=y(i)
document.all("pic"&i).style.left=x(i)
next
REM start bouncing
bnce
end sub
sub bnce()
ClearTimeOut(myTimer)
REM VBScript
version of bounce routine
REM Loop for each
object
for i=0 to numPics
if c(i)=1 then
REM This one is
bouncing so check to see if
REM it is near the
juggler. If too close, catch it.
if x(i)<50 and
y(i)<50 then
c(i)=0
ox(i)=4
oy(i)=-4
end if
REM Calculate next
move for bouncing object.
p="pic"&i
Set bal=document.all(p)
REM Increment
position
REM
x(i)=x(i)+ox(i)*1.5
y(i)=y(i)+oy(i)
REM Check for
walls on right or left
if (x(i) + bal.offsetWidth
> cW + sL) OR (x(i) <= sL) then
ox(i)=-ox(i)
if (x(i) < sL)
then x(i) = sL
if (x(i) + bal.width
> cW + sL) then x(i) = cW - bal.offsetWidth + sL
end if
REM Check for
walls on bottom or top
if (y(i) + bal.offsetHeight
> cH + sT) OR (y(i) <= sT+R) then
oy(i)=-oy(i)
if (y(i) < sT+R)
then y(i) = sT+R
if (y(i) + bal.offsetHeight
> cH + sT) then y(i) = cH - bal.offsetHeight + sT
end if
REM Position
object
bal.style.posTop =
y(i)
bal.style.posLeft
= x(i)
else
REM Juggle the
images
an(i)=an(i)-.1
x(i)=Int(COS(an(i))*
50)+70+sL
y(i)=Int(SIN(an(i))*
50)+70+sT
document.all("pic"&i).style.top=y(i)
document.all("pic"&i).style.left=x(i)
REM Pick a number
sw=INT(rnd*1000)
REM If number is
divisible by 333 then release bird.
if sw mod 333 = 0
then c(i)=1
end if
next
REM Repeat. If
bounce is too fast, increase the number
REM in the line
below from the default value of 2.
myTimer=SetTimeOut("bnce",4)
end sub
REM This sub
starts the action as soon as the message is received.
sub window_OnLoad()
setUp
end sub
REM In case window
is re-sized then re-calculate
sub
window_OnResize()
setUp
end sub
REM In case text
is scrolled, this keeps the bouncing objects inside the window.
sub
window_OnScroll()
sL=w.scrollLeft
sT=w.scrollTop
end sub
</SCRIPT>
|