Не сте регистриран! Регистрирайте се БЕЗПЛАТНО, за да използвате услугите на сайта!

 Ефектен курсор на мишката
Автор  mafcho (03.06.2008 07:54) съобщение до автора
Погледнат  745 пъти добави към любими
Оценка добави коментар
Гласове  -- изпрати на приятел
Коментари  (0) абонирай се за JavaScript
     
mafcho
     
 

Здравейте. Това е един интересен ефект за курсора на мишката във формата на ДжаваСкрипт. Тука не мисля че има нещо за пипане, според мен така си е достатъчно ефектен скрипта. Просто го поставете в бодито на уеб документа.

Това е кодът на скрипта.

CODE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<script language="JavaScript">

if (document.all){
with (document){
write('<div id="starsDiv" style="position:absolute;top:0px;left:0px">')
write('<div style="position:relative;width:1px;height:1px;background:#ffffff;font-size:1px;visibility:visible"></div>')
write('<div style="position:relative;width:1px;height:1px;background:#fff000;font-size:1px;visibility:visible"></div>')
write('<div style="position:relative;width:1px;height:1px;background:#ffa000;font-size:1px;visibility:visible"></div>')
write('<div style="position:relative;width:1px;height:1px;background:#ff00ff;font-size:1px;visibility:visible"></div>')
write('<div style="position:relative;width:1px;height:1px;background:#00ff00;font-size:1px;visibility:visible"></div>')
write('<div style="position:relative;width:1px;height:1px;background:#0000ff;font-size:1px;visibility:visible"></div>')
write('<div style="position:relative;width:1px;height:1px;background:#FF0000;font-size:1px;visibility:visible"></div>')
write('<div style="position:relative;width:2px;height:2px;background:#ffffff;font-size:2px;visibility:visible"></div>')
write('<div style="position:relative;width:2px;height:2px;background:#fff000;font-size:2px;visibility:visible"></div>')
write('<div style="position:relative;width:2px;height:2px;background:#ffa000;font-size:2px;visibility:visible"></div>')
write('<div style="position:relative;width:2px;height:2px;background:#ff00ff;font-size:2px;visibility:visible"></div>')
write('<div style="position:relative;width:2px;height:2px;background:#00ff00;font-size:2px;visibility:visible"></div>')
write('<div style="position:relative;width:2px;height:2px;background:#0000ff;font-size:2px;visibility:visible"></div>')
write('<div style="position:relative;width:3px;height:3px;background:#FF0000;font-size:3px;visibility:visible"></div>')
write('</div>')
}
}

if (document.layers)
{
window.captureEvents(Event.MOUSEMOVE);}
var yBase = 200;
var xBase = 200;
var step = 1;
var currStep = 0;
var Xpos = 1;
var Ypos = 1;

if (document.all)
{
 
function MoveHandler(){
 
Xpos = document.body.scrollLeft+event.x;
 
Ypos = document.body.scrollTop+event.y;
 
}
 
document.onmousemove = MoveHandler;
}

else if (document.layers)
{
 
function xMoveHandler(evnt){
 
Xpos = evnt.pageX;
 
Ypos = evnt.pageY;
 
}
 
window.onMouseMove = xMoveHandler;
}

function animateLogo() {
if (document.all)
{
 
yBase = window.document.body.offsetHeight/6;
 
xBase = window.document.body.offsetWidth/6;
}
else if (document.layers)
{
 
yBase = window.innerHeight/8;
 
xBase = window.innerWidth/8;
}

if (document.all)
{
 
for ( i = 0 ; i < starsDiv.all.length ; i++ )
 {
 
starsDiv.all[i].style.top = Ypos + yBase*Math.sin((currStep + i*4)/12)*Math.cos(400+currStep/200);
 
starsDiv.all[i].style.left = Xpos + xBase*Math.sin((currStep + i*3)/10)*Math.sin(currStep/200);
 
}
}

else if (document.layers)
{
 
for ( j = 0 ; j < 14 ; j++ )
 {
 
var templayer="a"+j
 
document.layers[templayer].top = Ypos + yBase*Math.sin((currStep + j*4)/12)*Math.cos(400+currStep/200);
 
document.layers[templayer].left = Xpos + xBase*Math.sin((currStep + j*3)/10)*Math.sin(currStep/200);
 
}
}
currStep+= step;
setTimeout("animateLogo()", 10);
}
animateLogo();
</
script>

Надявам се да ви хареса.
Ето ДЕМО-то. http://mafcho.hit.bg/demo/cursor.htm



Ключови думи: трик ефект за курсора на мишката




 1 посетител чете този скрипт (0 потребители и 1 гост)  
Активни потребители: ---
   
  

Еmail  
 

 

 
  • Интересно от Софтуер
 
  • Интересно от myLINKS
 
 
 
 



IT-PLACE.NET © 2004 - 2008