skip to main
|
skip to sidebar
Serdadu Banten
NavBar
Search This Blog
Home
Posts RSS
Comments RSS
Edit
Senin, 06 Agustus 2012
Script Untuk Membuat Efek Salju
Diposting oleh
Serdadu Banten
di
03.31
Script untuk Membuat Efek Salju adalah sebagai berikut:
<script type='text/javascript'>
//Snow alias salju hehehe...
if ((document.getElementById) &&
window.addEventListener || window.attachEvent){
(function(){
//Configure here.
var num = 30; //Number of flakes
var timer = 30; //setTimeout speed. Varies on different comps
var enableinNS6 = 1 //Enable script in NS6/Mozilla? Snow animation could be slow in those browsers. (1=yes, 0=no).
//End.
var y = [];
var x = [];
var fall = [];
var theFlakes = [];
var sfs = [];
var step = [];
var currStep = [];
var h,w,r;
var d = document;
var pix = "px";
var domWw = (typeof window.innerWidth == "number");
var domSy = (typeof window.pageYOffset == "number");
var idx = d.getElementsByTagName('div').length;
if (d.documentElement.style &&
typeof d.documentElement.style.MozOpacity == "string")
num = 12;
for (i = 0; i < num; i++){
sfs[i] = Math.round(1 + Math.random() * 1);
document.write('<div id="flake'+(idx+i)+'" style="position:absolute;top:0px;left:0px;width:'
+sfs[i]+'px;height:'+sfs[i]+'px;background-color:#ffffff;font-size:'+sfs[i]+'px"><\/div>');
currStep[i] = 0;
fall[i] = (sfs[i] == 1)?
Math.round(2 + Math.random() * 2): Math.round(3 + Math.random() * 2);
step[i] = (sfs[i] == 1)?
0.05 + Math.random() * 0.1 : 0.05 + Math.random() * 0.05 ;
}
if (domWw) r = window;
else{
if (d.documentElement &&
typeof d.documentElement.clientWidth == "number" &&
d.documentElement.clientWidth != 0)
r = d.documentElement;
else{
if (d.body &&
typeof d.body.clientWidth == "number")
r = d.body;
}
}
function winsize(){
var oh,sy,ow,sx,rh,rw;
if (domWw){
if (d.documentElement && d.defaultView &&
typeof d.defaultView.scrollMaxY == "number"){
oh = d.documentElement.offsetHeight;
sy = d.defaultView.scrollMaxY;
ow = d.documentElement.offsetWidth;
sx = d.defaultView.scrollMaxX;
rh = oh-sy;
rw = ow-sx;
}
else{
rh = r.innerHeight;
rw = r.innerWidth;
}
h = rh - 2;
w = rw - 2;
}
else{
h = r.clientHeight - 2;
w = r.clientWidth - 2;
}
}
function scrl(yx){
var y,x;
if (domSy){
y = r.pageYOffset;
x = r.pageXOffset;
}
else{
y = r.scrollTop;
x = r.scrollLeft;
}
return (yx == 0)?y:x;
}
function snow(){
var dy,dx;
for (i = 0; i < num; i++){
dy = fall[i];
dx = fall[i] * Math.cos(currStep[i]);
y[i]+=dy;
x[i]+=dx;
if (x[i] >= w || y[i] >= h){
y[i] = -10;
x[i] = Math.round(Math.random() * w);
fall[i] = (sfs[i] == 1)?
Math.round(2 + Math.random() * 2): Math.round(3 + Math.random() * 2);
step[i] = (sfs[i] == 1)?
0.05 + Math.random() * 0.1 : 0.05 + Math.random() * 0.05 ;
}
theFlakes[i].top = y[i] + scrl(0) + pix;
theFlakes[i].left = x[i] + scrl(1) + pix;
currStep[i]+=step[i];
}
setTimeout(snow,timer);
}
function init(){
winsize();
for (i = 0; i < num; i++){
theFlakes[i] = document.getElementById("flake"+(idx+i)).style;
y[i] = Math.round(Math.random()*h);
x[i] = Math.round(Math.random()*w);
}
snow();
}
if (window.addEventListener){
window.addEventListener("resize",winsize,false);
window.addEventListener("load",init,false);
}
else if (window.attachEvent){
window.attachEvent("onresize",winsize);
window.attachEvent("onload",init);
}
})();
}//tamat
</script>
Untuk caranya seperti biasa:
1. Click "Tata Letak"
2. Click "Edit Laman"
3. Click "Tambah Gadget" pilih "HTML/javascript"
0 komentar:
Posting Komentar
Posting Lama
Beranda
Langganan:
Posting Komentar (Atom)
About me
Maaf Ya, Di Blog Ini Tidak Di Ijinkan Untuk Klik Kanan
Diberdayakan oleh
Blogger
.
Pages
Beranda
About
Serdadu Banten
Lihat profil lengkapku
Bahasa Yang Kamu Gunakan
Labels
Asal Muasal
(6)
Cara Membuat Skripsi
(8)
Cerita Dan Kisah
(24)
Facebook
(5)
Flora Dan Fauna
(3)
Kata Kata Mutiara Terbaru
(3)
Master Blog
(25)
Puisi Cinta
(5)
Puisi Cinta Bag 01
(9)
Puisi Cinta Bag 02
(6)
Puisi Cinta Bag 03
(7)
Puisi Cinta Bag 04
(7)
Puisi Cinta Bag 05
(7)
Puisi Cinta Bag 06
(8)
Puisi Cinta Bag 07
(8)
Puisi Cinta Bag 08
(7)
Puisi Cinta Bag 09
(9)
Puisi Cinta Bag 10
(7)
Puisi Cinta Bag 11
(7)
Puisi Cinta Bag 12
(9)
Puisi Cinta Bag 13
(6)
Puisi Cinta Bag 14
(8)
Puisi Cinta Bag 15
(9)
Puisi Religius Bag 01
(11)
Puisi Religius Bag 02
(8)
Puisi Religius Bag 03
(3)
Sejarah Pegunungan Yang Ada Di Banten
(5)
Tafsir Mimpi
(10)
Valentine Days
(7)
Wisata
(4)
Archive
▼
2012
(254)
▼
Agustus
(3)
Script Untuk Membuat Efek Salju
Cara Menambahkan Tulisan Melayang Di Blog Dan Floa...
Cara Membuat Salam Pembuka Dan Penutup Di Blog
►
Juli
(251)
Copyright 2008
Serdadu Banten
. All rights reserved
Posts Feed
Comments Feed
Minima 4 coloum Blogger Template by
Serdadu Banten
.
Simplicity Edited by
Serdadu Banten's Template
0 komentar:
Posting Komentar