鼠标特效代码教程(代码鼠标点击效果)

http://www.itjxue.com  2023-02-06 01:41  来源:未知  点击次数: 

flash中移动鼠标时产生特效

从大的说这是运用了鼠标跟随的手法,但你所说的效果充其量只是仿制鼠标跟随,也就是在你所能看到的范围,也是制作者制作FLA文件时的舞台范围,比如鼠标经过的地方想出现一朵小花,首先制作一朵花,当然花的图形的大小不家宜过大,否则鼠标经过时,就会出现一朵很大的花,这种效果就没有了,然后进行复制,把整个舞台都铺满,然后就是给这些花设置“不可见”代码了,然后给鼠标添加事件,即当鼠标滑过时,对象“可见”,OK,效果就出来了。这是最笨的制作方法了,至于如果添加代码的问题,如果你感兴趣的话,就自己到网上找下FLASH视频教程,开始学习吧。祝你成功。

QQ空间鼠标跟随特效怎么制作

告诉你。。如果不会用FLASH是很难的。。。有一大堆代码。。不晕才怪。。。林空间。。有教程。。可以百度上查一下如果有地址就很简单了FLASH鼠标地址...(做法跟添加FLASH模块一样)真的很好看... 鼠标蝴蝶跟随

鼠标美丽蝴蝶

一朵花跟随

飞舞的蝴蝶

雪花-6(光标跟随

【求教】用html代码制作 鼠标点击图片的时候出现图片框并在图片上显示文字

不知道这个是不是你要找的。

headstyle type="text/css"

#floater {

position: absolute;

left: 500;

top: 146;

width: 125;

visibility: visible;

z-index: 10;

}/style

/head

body

div ID="floater" style="left: 590px; top: 158px"

p align="center"img SRC="2259.gif" alt="图片显示的文字" WIDTH="150" HEIGHT="60"br

font color="#FF8040"网页特效/font/p

/divscript LANGUAGE="JavaScript"

self.onError=null;

currentX = currentY = 0;

whichIt = null;

lastScrollX = 0; lastScrollY = 0;

NS = (document.layers) ? 1 : 0;

IE = (document.all) ? 1: 0;

!-- STALKER CODE --

function heartBeat() {

if(IE) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; }

if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; }

if(diffY != lastScrollY) {

percent = .1 * (diffY - lastScrollY);

if(percent 0) percent = Math.ceil(percent);

else percent = Math.floor(percent);

if(IE) document.all.floater.style.pixelTop += percent;

if(NS) document.floater.top += percent;

lastScrollY = lastScrollY + percent;

}

if(diffX != lastScrollX) {

percent = .1 * (diffX - lastScrollX);

if(percent 0) percent = Math.ceil(percent);

else percent = Math.floor(percent);

if(IE) document.all.floater.style.pixelLeft += percent;

if(NS) document.floater.left += percent;

lastScrollX = lastScrollX + percent;

}

}

!-- /STALKER CODE --

!-- DRAG DROP CODE --

function checkFocus(x,y) {

stalkerx = document.floater.pageX;

stalkery = document.floater.pageY;

stalkerwidth = document.floater.clip.width;

stalkerheight = document.floater.clip.height;

if( (x stalkerx x (stalkerx+stalkerwidth)) (y stalkery y (stalkery+stalkerheight))) return true;

else return false;

}

function grabIt(e) {

if(IE) {

whichIt = event.srcElement;

while (whichIt.id.indexOf("floater") == -1) {

whichIt = whichIt.parentElement;

if (whichIt == null) { return true; }

}

whichIt.style.pixelLeft = whichIt.offsetLeft;

whichIt.style.pixelTop = whichIt.offsetTop;

currentX = (event.clientX + document.body.scrollLeft);

currentY = (event.clientY + document.body.scrollTop);

} else {

window.captureEvents(Event.MOUSEMOVE);

if(checkFocus (e.pageX,e.pageY)) {

whichIt = document.floater;

StalkerTouchedX = e.pageX-document.floater.pageX;

StalkerTouchedY = e.pageY-document.floater.pageY;

}

}

return true;

}

function moveIt(e) {

if (whichIt == null) { return false; }

if(IE) {

newX = (event.clientX + document.body.scrollLeft);

newY = (event.clientY + document.body.scrollTop);

distanceX = (newX - currentX); distanceY = (newY - currentY);

currentX = newX; currentY = newY;

whichIt.style.pixelLeft += distanceX;

whichIt.style.pixelTop += distanceY;

if(whichIt.style.pixelTop document.body.scrollTop) whichIt.style.pixelTop = document.body.scrollTop;

if(whichIt.style.pixelLeft document.body.scrollLeft) whichIt.style.pixelLeft = document.body.scrollLeft;

if(whichIt.style.pixelLeft document.body.offsetWidth - document.body.scrollLeft - whichIt.style.pixelWidth - 20) whichIt.style.pixelLeft = document.body.offsetWidth - whichIt.style.pixelWidth - 20;

if(whichIt.style.pixelTop document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5) whichIt.style.pixelTop = document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5;

event.returnValue = false;

} else {

whichIt.moveTo(e.pageX-StalkerTouchedX,e.pageY-StalkerTouchedY);

if(whichIt.left 0+self.pageXOffset) whichIt.left = 0+self.pageXOffset;

if(whichIt.top 0+self.pageYOffset) whichIt.top = 0+self.pageYOffset;

if( (whichIt.left + whichIt.clip.width) = (window.innerWidth+self.pageXOffset-17)) whichIt.left = ((window.innerWidth+self.pageXOffset)-whichIt.clip.width)-17;

if( (whichIt.top + whichIt.clip.height) = (window.innerHeight+self.pageYOffset-17)) whichIt.top = ((window.innerHeight+self.pageYOffset)-whichIt.clip.height)-17;

return false;

}

return false;

}

function dropIt() {

whichIt = null;

if(NS) window.releaseEvents (Event.MOUSEMOVE);

return true;

}

!-- DRAG DROP CODE --

if(NS) {

window.captureEvents(Event.MOUSEUP|Event.MOUSEDOWN);

window.onmousedown = grabIt;

window.onmousemove = moveIt;

window.onmouseup = dropIt;

}

if(IE) {

document.onmousedown = grabIt;

document.onmousemove = moveIt;

document.onmouseup = dropIt;

}

if(NS || IE) action = window.setInterval("heartBeat()",1);

/script

/boyd

Flash中做放大效果,跟随鼠标移动的。还要显示那放大镜的,求详细步骤

本文中我们用Flash遮罩轻松制作鼠标弹性跟随放大镜,做起来不难,而且效果还不错,有些简单的部分我就不细讲了。

先看效果:

 1、首先建一个影片剪辑pic,导入一张图片;

2、再建一个影片剪辑mask,画一个无边线的圆;

3、回到主场景,新建四层,第一层从库中拖入影片剪辑pic,透明度调为60左右,第二层将第一层原位复制,再将该层的图片放大至120%,把俩层的图片都对齐至舞台中央;

4、第三层拖入影片剪辑mask,实例名也命名为mask;

5、然后在第四层加入以下代码:

//mask弹性跟随鼠标的速度,该值越大则越慢

var speed = 5;

//构造一个函数,让mask弹性跟随鼠标

MovieClip.prototype.follow = function() {

//该函数继承MovieClip的所有属性

this.onEnterFrame = function() {

//弹性缓冲公式,大多数都是这种形式

this._x += (_root._xmouse-this._x)/speed;

this._y += (_root._ymouse-this._y)/speed;

//当到达鼠标的位置时删除进入帧事件

if (Math.abs(_root._xmouse-this._x)1 Math.abs(_root._ymouse-this._y)1) {

delete this.onEnterFrame;

}

};

};

//当鼠标移动时调用上面构造好的函数

onMouseMove = function () {

mask.follow();

};

(责任编辑:IT教学网)

更多

推荐windows vista文章