|
<SCRIPT LANGUAGE=vbscript><!--
dim Sirka,Vyska
dim x,y,k,a
dim poleBub(8)
dim Bx(8),By(8),KB(8)
dim ScT
dim casovac
dim casovacBub
Sub animuj()'pohyb delfina
x=x+1*k
y=Vyska-100
pohyb.style.posLeft=x
pohyb.style.posTop=y
if x>Sirka-pohyb.offsetWidth-30 then
k=-1'do lava
pohyb.style.filter = ""'normalna poloha
delfina
end if
if x<10 then
k=1' do prava
pohyb.style.filter = "flipH"'prevrati
obrazok delfina
end if
BublinaStart
End Sub
Sub window_onload
'set poleBub(0)=B1 Vynechane
set poleBub(1)=B1
set poleBub(2)=B2
set poleBub(3)=B3
set poleBub(4)=B4
set poleBub(5)=B5
set poleBub(6)=B6
set poleBub(7)=B7
set poleBub(8)=B8
k=1
ScT=window.document.body.scrollTop
Sirka=document.body.offsetWidth
Vyska= document.body.offsetHeight+ScT
for i=1 to 8
By(i)=Vyska'schovaj bubliny za okraj
Next
Randomize'refres RND
casovac= window.setInterval ("animuj",10)'start
delfin
casovacBub= window.setInterval ("animujBub",20)'start
bublina
End Sub
Sub window_onresize'zmena
okna
ScT=window.document.body.scrollTop
Sirka=document.body.offsetWidth
Vyska= document.body.offsetHeight+ScT
End Sub
Sub window_onscroll
ScT=window.document.body.scrollTop
Sirka=document.body.offsetWidth
Vyska= document.body.offsetHeight+ScT
End Sub
Sub BublinaStart
a=int(rnd(1)*200+1)'vyber nahodne cisla
b=int(rnd(1)*8)+1
if a<60 then f=-2
if a>60 then f=2
Bx(b)=int(rnd(1)*f)'pre bublinu X
if a>8 then exit sub 'len do cisla 8
if KB(a)<>0 then exit sub' ak je bublina na
konci
select case a'spust bublinu cislo
case 1
By(1)=0
KB(1)=1
poleBub(1).style.posLeft=x+pohyb.offsetWidth/2
case 2
By(2)=0
KB(2)=1
poleBub(2).style.posLeft=x +pohyb.offsetWidth/2
case 3
By(3)=0
KB(3)=1
poleBub(3).style.posLeft=x +pohyb.offsetWidth/2
case 4
By(4)=0
KB(4)=1
poleBub(4).style.posLeft=x +pohyb.offsetWidth/2
case 5
By(5)=0
KB(5)=1
poleBub(5).style.posLeft=x +pohyb.offsetWidth/2
case 6
By(6)=0
KB(6)=1
poleBub(6).style.posLeft=x +pohyb.offsetWidth/2
case 7
By(7)=0
KB(7)=1
poleBub(7).style.posLeft=x +pohyb.offsetWidth/2
case 8
By(8)=0
KB(8)=1
poleBub(8).style.posLeft=x +pohyb.offsetWidth/2
end select
End Sub
Sub animujBub()'pohybuj
bublinami
for i=1 to 8
By(i)=By(i)+KB(i)
poleBub(i).style.posTop=y-By(i)'bublina Y
poleBub(i).style.posLeft=poleBub(i).style.posLeft+Bx(i)'bublina
X
if poleBub(i).style.posTop<-5+ScT then KB(i)=0'ak
je bublina za okrajom
Next
End sub
--></SCRIPT> |