·
网页特效库
·
网页工具库
背景按钮
导航特效
图片特效
文本特效
时间特效
状态特效
另类特效
网页制作
网站首页
< 后退
|
收藏网页特效库
推荐网页特效
购物网站的导航效果,推荐!
向上下左右滚动图片的特效
超级变态广告代码
设为首页
加入收藏夹
防止选择和复制
新浪博客的提示窗口,推荐!
推荐网页工具
在线html编辑器
在线CSS编辑器
滚动条颜色生成器
弹出窗口生成器
网页加密解密工具
汉字转换成拼音工具
文本繁简体转换工具
您的位置:
网页特效库
>>
网页文本特效
>> 由纯文本实现的动画效果
查看此特效演示
由纯文本实现的动画效果
把如下代码复制到<head>与</head>之间
<script type="text/javascript">function Path() { this.concat = int_concat; this.add = int_add; this.rotate = int_rot; function int_concat(p) { return new PathList(new Array(this, p)); } function int_add(p) { return new PathAdd(this, p); } function int_rot(xc,yc,v) { return new RotatePath(this, xc, yc, v); } } // The following object is used for the concat function PathList(inPathList) { // All path objects must have these 5 methods this.x = 0; // Retrieves the current x value this.y = 0; this.step = int_step; // Move to next step this.reset = int_reset; // Resets the current position // The rest may vary from different path objects this.pathList = inPathList; this.currentPath = 0; function int_step() { if (this.currentPath >= this.pathList.length) return false; if (this.pathList[this.currentPath].step()) { this.x = this.pathList[this.currentPath].x; this.y = this.pathList[this.currentPath].y; } else { this.currentPath++; if (this.currentPath >= this.pathList.length) return false; this.x = this.pathList[this.currentPath].x; this.y = this.pathList[this.currentPath].y; } return true; } function int_reset() { this.currentPath = 0; for (var i=0; i<this.pathList.length; i++) this.pathList[i].reset(); this.x = this.pathList[this.currentPath].x; this.y = this.pathList[this.currentPath].y; } } // The following object is used for adding two paths function PathAdd(p1,p2) { // All path objects must have these 5 methods this.x = 0; // Retrieves the current x value this.y = 0; this.step = int_step; // Move to next step this.reset = int_reset; // Resets the current position // The rest may vary from different path objects this._p1 = p1; this._p2 = p2; function int_step() { var c1 = this._p1.step(); var c2 = this._p2.step(); this.x = this._p1.x + this._p2.x; this.y = this._p1.y + this._p2.y; return (c1 || c2); } function int_reset() { this._p1.reset(); this._p2.reset(); this.x = this._p1.x + this._p2.x; this.y = this._p1.y + this._p1.y; } } function RotatePath(p,xc,yc,v) { this.x = 0; // Retrieves the current x value this.y = 0; this.step = int_step; // Move to next step this.reset = int_reset; // Resets the current position // The rest may vary from different path objects this._p = p; this._xc = xc; this._yc = yc; this._v = v; function int_step() { var c = this._p.step(); var pol = toPol(this._p.x - this._xc, this._p.y - this._yc); var rec = toRec(pol.r, pol.v + toRad(this._v)); this.x = rec.x + this._xc; this.y = rec.y + this._yc; return c; } function int_reset() { this._p.reset(); var pol = toPol(this._p.x - this._xc, this._p.y - this._yc); var rec = toRec(pol.r, pol.v + toRad(this._v)); this.x = rec.x - this._xc; this.y = rec.y - this._yc; } function toPol(x,y) { var o = new Object(); o.r = Math.sqrt(x*x + y*y); if (x == 0) o.v = Math.PI / 2; else o.v = Math.atan(y/x); if (x < 0) o.v = o.v + Math.PI; return o; } function toRec(r,v) { var o = new Object(); o.x = r * Math.cos(v); o.y = r * Math.sin(v); return o; } function toRad(deg) { return deg*Math.PI/180; } } PathAdd.prototype = new Path; PathList.prototype = new Path; RotatePath.prototype = new Path; </script> <script type="text/javascript">function CirclePath(x, y, _xr, _yr, fromV, toV, n) { // All path objects must have these 5 methods this.x = 0; // Retrieves the current x value this.y = 0; this.step = int_step; // Move to next step this.reset = int_reset; // The rest may vary from different path objects this.steps = n; // NN work around. NN can't handle local variables!!! this.stepsLeft = n; this.xp = x; this.yp = y; this.v = -toRad(fromV); this.startV = this.v; this.endV = -toRad(toV); this.xr = _xr; this.yr = _yr; this.x = getX(this.xp,this.xr,this.v); this.y = getY(this.yp,this.yr,this.v); function toRad(deg) { return deg*Math.PI/180; } function getX(xp, xr, v) { // alert("xp: " + xp + "\nxr: " + xr + "\nv: " + v); return xp + xr*Math.cos(v); } function getY(yp, yr, v) { return yp + yr*Math.sin(v); } // Initate steps if (this.steps > 0) this.deltaV = (this.endV - this.startV)/n; // work around netscape bug. Netscape couldn't handle this else { // as a local variable this.deltaV = 0; this.x = getX(this.xp,this.xr,this.endV); this.y = getY(this.yp,this.yr,this.endV); } function int_step() { if (this.stepsLeft > 0) { this.v += this.deltaV; this.x = getX(this.xp,this.xr,this.v); this.y = getY(this.yp,this.yr,this.v); this.stepsLeft--; return true; } return false; } function int_reset() { if (this.steps < 1) { this.x = getX(this.xp,this.xr,this.endV); this.y = getY(this.yp,this.yr,this.endV); } else { this.v = this.startV; this.x = getX(this.xp,this.xr,this.v); this.y = getY(this.yp,this.yr,this.v); this.stepsLeft = this.steps; } } } CirclePath.prototype = new Path; </script> <script type="text/javascript">function StraightPath(fromX, fromY, toX, toY, n) { // All path objects must have these 5 methods this.x = fromX; // Retrieves the current x value this.y = fromY; this.step = int_step; // Move to next step // Returns true if the step was succesfull // Returns false when the path has been done this.reset = int_reset; // The rest may vary from different path objects this.startX = fromX; this.startY = fromY; this.endX = toX; this.endY = toY; // Initiate steps this.steps = n; this.totalSteps = n; if (this.totalSteps < 1) { // No Amimation! this.x = this.endX; this.y = this.endY; this.deltaX = 0; // NN work around this.deltaY = 0; } else { this.deltaX = (this.endX - this.startX) / this.totalSteps; this.deltaY = (this.endY - this.startY) / this.totalSteps; } function int_step() { if (this.steps >= 0) { this.steps--; this.x += this.deltaX; this.y += this.deltaY; } return (this.steps >= 0 ); } function int_reset() { if (this.totalSteps < 1) { this.steps = 0; this.x = this.endX; this.y = this.endY; } else { this.steps = this.totalSteps; this.x = this.startX; this.y = this.startY; } } } StraightPath.prototype = new Path; </script> <script type="text/javascript">var animIndex = 0; var animArray = new Array(); function Animator(id, p, period) { this.play = int_play; this.pause = int_pause; this.stop = int_stop; this.onanimationdone; this.elstyle = null; this.path = p; this.msec = period; this.id = id; this.index = animIndex; animArray[this.index] = this; this.thisString = "animArray[" + this.index + "]"; animIndex++; function int_play() { if (this.elstyle == null) { // this.elstyle = (document.all != null) ? document.all[this.id].style : document.layers[this.id]; if (document.all) // IE4 this.elstyle = document.all[this.id].style; else if (document.getElementById) // NGLayout this.elstyle = document.getElementById(this.id).style; else if (document.layers) // nn4.x this.elstyle = document.layers[this.id] else return; } if (this.path.step()) { this.elstyle.left = this.path.x; this.elstyle.top = this.path.y; animArray[this.index].timer = setTimeout(this.thisString + ".play()", this.msec); } else if (this.onanimationdone != null) { if (typeof(this.onanimationdone) == "string") eval(this.onanimationdone); else if (typeof(this.onanimationdone) == "function") this.onanimationdone(); } } function int_pause() { clearTimeout(animArray[this.index].timer); } function int_stop() { clearTimeout(animArray[this.index].timer); this.path.reset(); } } </script>
把如下代码复制到<body>与</body>之间
<div style="width: 380;"> <script type="text/javascript">var localHeadingDownloadURL = "http://www.butong.net"; function includeHeading(title, url) { dw = new Function("x", "document.write(x)"); if (url != null) localHeadingDownloadURL = url; if (document.all != null) { dw('<style type="text/css">'); dw('<!--'); dw('#hdBox {position: relative;'); dw(' width: 300; height: 80; padding-left: 20px; padding-right: 50px;'); dw(' border: 10 solid #eeeeee; background: white; margin-right: -55;}'); dw('#hdCircle1 {position: relative; top:20; left: 0; width: 100; cursor: hand;'); dw(' font-family: webdings; font-size: 80;'); dw(' color: #eeeeee; margin-right: -90;}'); dw('#hdCircle2 {position: relative; top: 10; left: 0; width: 80; cursor: hand;'); dw(' font-family: webdings; font-size: 60;'); dw(' color: white; margin-right: -52;}'); dw('#hdTitle {position: relative; top: 0; left: 0;'); dw(' color: navy; font-family: arial black; font-size: 40px;'); dw(' font-style: italic;}'); dw('#hdDl {position: relative; top: -12; left: 4;'); dw(' filter: gray(); cursor: hand;}'); dw('-->'); dw('</style>'); dw('<div style="text-align: center; overflow: hidden; margin: 20px;" nowrap>'); dw('<span id="hdBox">'); dw('<div id="hdTitle" nowrap>'); // Title inserted here dw(title); dw('</div>'); dw('</span>'); dw('<span id="hdCircle1" onmouseover="headDownloadHigh()" onmouseout="headDownloadLow()" onclick="headDownload()">n</span>'); dw('<span id="hdCircle2" onmouseover="headDownloadHigh()" onmouseout="headDownloadLow()" onclick="headDownload()">n</span>'); dw('<img id="hdDl" onmouseover="headDownloadHigh()" onmouseout="headDownloadLow()" onclick="headDownload()"'); dw(' src="go.gif" width=23 height=23 border=0 alt="Download">'); dw('</div>'); } else { dw('<h1>' + title + '</h1>'); if (localHeadingDownloadURL != "") dw('<p><a href="' + localHeadingDownloadURL + '">Download</a></p>'); } } function headDownloadHigh() { hdCircle1.style.color ="navy"; hdDl.style.filter =""; window.status = "Download this sample"; } function headDownloadLow() { toEl = window.event.toElement; if (toEl == null || toEl.id != "hdCircle1" && toEl.id != "hdCircle2" && toEl.id != "hdDl") { hdCircle1.style.color ="#eeeeee"; hdDl.style.filter ="gray()"; window.status = ""; } } //URL inserted here function headDownload() { if (localHeadingDownloadURL != "") window.open(localHeadingDownloadURL,'_top'); else alert("There is currently no downloadable file for this page"); } </script> <script type="text/javascript"> includeHeading("http://www.butong.net"); </script> </div> <div id="dot2" style="position: absolute; top: 150; left: 150; width: 100; font: 10px webdings; color: navy;">n</div> <script type="text/javascript"> <!-- c1 = new StraightPath(222,16,712,16,20); c2 = new StraightPath(712,16,712,35,1); c3 = new CirclePath(711,71,36,36,85,-150,10); c4 = new StraightPath(680,86,222,86,17); c5 = new StraightPath(222,86,222,16,7); d = new StraightPath(-182,0,-182,0,1); c6 = c1.concat(c2).concat(c3).concat(c4).concat(c5); c = d.add(c6); a2 = new Animator("dot2", c, 50); a2.onanimationdone = "a2.stop();a2.play()"; a2.play(); //--> </script> <CENTER></CENTER>
上一个特效:
文字在页面上蜿蜒飞舞
返回列表
下一个特效:
文字下落效果
关于我们
|
联系本站
|
免责声明
|
版权声明
|
网站地图
|
友情链接
|
鄂ICP备05023174号
Copyright © 2008
www.butong.net
.All Rights Reserved.