![]() |
![]() ![]() |
![]() |
![]() ![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 87 Pomógł: 6 Dołączył: 30.11.2008 Ostrzeżenie: (0%) ![]() ![]() |
Kod var SNOW_Picture = "images/snieg.gif" var SNOW_no = 20; var SNOW_browser_IE_NS = (document.body.clientHeight) ? 1 : 0; var SNOW_browser_MOZ = (self.innerWidth) ? 1 : 0; var SNOW_browser_IE7 = (document.documentElement.clientHeight) ? 1 : 0; var SNOW_Time; var SNOW_dx, SNOW_xp, SNOW_yp; var SNOW_am, SNOW_stx, SNOW_sty; var i, SNOW_Browser_Width, SNOW_Browser_Height; if (SNOW_browser_IE_NS) { SNOW_Browser_Width = document.body.clientWidth; SNOW_Browser_Height = document.body.clientHeight; } else if (SNOW_browser_MOZ) { SNOW_Browser_Width = self.innerWidth - 25; SNOW_Browser_Height = self.innerHeight; } else if (SNOW_browser_IE7) { SNOW_Browser_Width = document.documentElement.clientWidth; SNOW_Browser_Height = document.documentElement.clientHeight; } SNOW_dx = new Array(); SNOW_xp = new Array(); SNOW_yp = new Array(); SNOW_am = new Array(); SNOW_stx = new Array(); SNOW_sty = new Array(); for (i = 0; i < SNOW_no; ++ i) { SNOW_dx[i] = 0; SNOW_xp[i] = Math.random()*(SNOW_Browser_Width-50); SNOW_yp[i] = Math.random()*SNOW_Browser_Height; SNOW_am[i] = Math.random()*25; SNOW_stx[i] = 0.02 + Math.random()/15; SNOW_sty[i] = 0.7 + Math.random(); if (i == 0) document.write("<\div id=\"SNOW_flake"+ i +"\" style=\"position: absolute; z-index: "+ i +"; visibility: visible; top: 15px; left: 15px;\"><a href=\"http://www.lukas-art.unl.pl\" target=\"_blank\"><\img src=\""+SNOW_Picture+"\" border=\"0\"></a><\/div>"); else document.write("<\div id=\"SNOW_flake"+ i +"\" style=\"position: absolute; z-index: "+ i +"; visibility: visible; top: 15px; left: 15px;\"><\img src=\""+SNOW_Picture+"\" border=\"0\"><\/div>"); } function SNOW_Weather() { for (i = 0; i < SNOW_no; ++ i) { SNOW_yp[i] += SNOW_sty[i]; if (SNOW_yp[i] > SNOW_Browser_Height-50) { SNOW_xp[i] = Math.random()*(SNOW_Browser_Width-SNOW_am[i]-30); SNOW_yp[i] = 0; SNOW_stx[i] = 0.02 + Math.random()/10; SNOW_sty[i] = 0.7 + Math.random(); } SNOW_dx[i] += SNOW_stx[i]; document.getElementById("SNOW_flake"+i).style.top=SNOW_yp[i]+"px"; document.getElementById("SNOW_flake"+i).style.left=SNOW_xp[i] + SNOW_am[i]*Math.sin(SNOW_dx[i])+"px"; } SNOW_Time = setTimeout("SNOW_Weather()", 20); } SNOW_Weather(); Mam taki kod do śniegu i wszystko jest ok, ale chciałbym żeby trochę szybciej przemieszczał się po ekranie. Jak to zrobić?? Z góry thx za pomoc (IMG:http://forum.php.pl/style_emoticons/default/smile.gif) Już sobie poradziłem (IMG:http://forum.php.pl/style_emoticons/default/biggrin.gif) I jeszcze jedna sprawa dotycząca śniegu: Jak zrobić żeby śnieg padał tylko na tle, a nie przez wszystkie obrazki (IMG:http://forum.php.pl/style_emoticons/default/haha.gif) |
|
|
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 555 Pomógł: 84 Dołączył: 20.02.2008 Skąd: Małopolska Ostrzeżenie: (0%) ![]() ![]() |
A nie prościej jest to zrobić "gif-em" i dać jako background-image całej strony ?
|
|
|
![]()
Post
#3
|
|
Grupa: Moderatorzy Postów: 15 467 Pomógł: 1451 Dołączył: 25.04.2005 Skąd: Szczebrzeszyn/Rzeszów ![]() |
Półmegowy GIF, nieźle. ;p
|
|
|
![]()
Post
#4
|
|
Grupa: Zarejestrowani Postów: 392 Pomógł: 7 Dołączył: 11.05.2008 Ostrzeżenie: (0%) ![]() ![]() |
Faktycznie Skie dobrze mówi, wiem ponieważ sam mam taką stronkę. Jednak plik *.gif musiałby być mały i tak zbudowany żeby odnieść wrażenie ciągłości spadającego śniegu. Inaczej będzie widać, że to obrazek przy obrazku.
Jeśli nie uda ci się znaleźć takiego gif-a będziesz musiał sam go zrobić. Jeśli się na to zdecydujesz pisz jeśli będziesz miał problem z kodem - choć trudne to nie jest. Ten post edytował Szunaj85 14.12.2008, 21:09:44 |
|
|
![]() ![]() |
![]() |
Aktualny czas: 23.08.2025 - 04:04 |