- 浏览: 24042 次
- 性别:
- 来自: 北京
最新评论
-
梧栖凤:
得把未经处理的脚本分享出来啊!
跨浏览器可8方向拖拽剪裁框 -
percy30856:
好东西 正在弄这个玩意儿 参考学习了
Animate Baseclass -
percy30856:
菲哥 你的头像,应该换成未满18岁禁止查看
很棒的时间线控件 -
stoneskin:
:哭笑写javascript的也是猿。。。。我们很多猿都是从写 ...
核心只要两行即可实现添加或移除className -
jamesmos:
enix2212 写道tiannet 写道enix2212 写 ...
核心只要两行即可实现添加或移除className
以下代码仅供参考,请下载附件代码,应该是文本编辑器过滤掉了某些字符导致不能运行。
1.改进了代码
2.修正了宽高变化时,从物体中心扩展。
3.修改构造函数,可以不使用new就能实例化。
4.组合了透明度变化
<!--<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">--> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Animate Baseclass</title> <style type="text/css"> #square { background: #eee; height: 120px; width: 120px; border: 2px solid #CCC; position: absolute; left: 100px; top: 100px; } </style> </head> <body> <div id="square">Animate</div> <script type="text/javascript"> function Animate(o,f,g){var h=this,indicator=arguments.callee,origin=null,config=null;if(!(h instanceof indicator))return new indicator(o,f,g);config={O:h.o=o,P:h.property=f,T:h.t=g.t||0,C:h.c=g.c||50,D:h.d=g.d||100,R:h.r=g.r||false};'function'===typeof(g.callback)&&(config.fn=g.callback);if(1!==config['O'].nodeType)return false;undefined===this.Tween&&(indicator.prototype.Tween=function(){return h.Bounce.apply(h,arguments)});indicator.prototype.constructor=indicator;indicator.prototype.Bounce=function(t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b}};indicator.prototype.fx=function(t,b,c,d){var a=Math.ceil(h.Tween.apply(h,arguments));if(a>h.c){return false}return(true===config['R']?(-a):(a))+origin};indicator.prototype.play=function(O,P){var t=config['T'],b=0,end=false;origin=parseInt(h.currentStyle(o,f));void function(){var a=h.fx(t,b,config['C'],config['D']);O.style[P]=a+'px';Math.abs(a)<config['C']+origin?(t++,setTimeout(arguments.callee,13)):end=true;(true===end&&undefined!==config['fn'])&&(setTimeout(function(){config['fn'].call(h)},300))}()};indicator.prototype.currentStyle=function(a,b){var c=null;return undefined!==a.currentStyle?a.currentStyle[b]:document.defaultView.getComputedStyle(a,null)[b]};Animate.doFade=function(a,b,c,d){var e=undefined!==window.ActiveXObject,calls=arguments.callee,t=this,step;b+=(c?1:-1)/a,(c?b>1:b<0)&&(b=c?1:0),e===true?t.style.filter='alpha(opacity='+b*100+')':t.style.opacity=b;(c?b<1:b>0)&&setTimeout(function(){calls.call(t,a,b,c,d)},1000/a);(c?b===1:b===0&&'undefined'!==typeof d)&&('function'===typeof d&&d.call(t))};Animate.fadeOut=function(a){Animate.doFade.call(this,a/10,1,false)};Animate.fadeIn=function(a){Animate.doFade.call(this,a/10,0,true)};h.play.call(h,config['O'],config['P'])}; */ //demo1 面积由中心变化 //Animate(square,'height',{c:square.offsetHeight,d:100}); //Animate(square,'width',{c:square.offsetWidth,d:100}); //demo2 综合运动及无限回调 /*new Animate(square,'left',{c:300,d:100,callback:function(){ setTimeout(function(){ new Animate(square,'width',{c:square.offsetWidth,d:200}); new Animate(square,'height',{c:square.offsetHeight,d:200}); new Animate(square,'top',{c:square.offsetHeight,r:true,d:200,callback: function(){ try{square.parentNode.removeChild(square)}catch(e){}; } }); fadeOut.call(square,300) ; },2000); }});*/ /*new Animate(square,'left',{c:300,d:100,callback:function(){ setTimeout(function(){ new Animate(square,'width',{c:square.offsetWidth,d:200}); new Animate(square,'height',{c:square.offsetHeight,d:200,callback:function(){ new Animate(square,'top',{c:square.offsetHeight,r:true,d:200,callback: function(){ //try{square.parentNode.removeChild(square)}catch(e){}; new Animate(square,'top',{c:square.offsetHeight,d:200,callback:function(){ new Animate(square,'top',{c:square.offsetHeight,d:200}); }}); } }); }}); //fadeOut.call(square,300) ; },2000); }}); */ //demo3 位置面积变化 //Animate(square,'top'); //1 //Animate(square,'width',{c:square.offsetWidth-100,d:100}); //2 //Animate(square,'left',{c:square.offsetHeight,d:100}); //demo4 不规则运动 //Animate(square,'left',{c:square.offsetWidth-100,d:100}); //Animate(square,'top',{c:square.offsetHeight,d:140}); </script> </body> </html>
1.改进了代码
2.修正了宽高变化时,从物体中心扩展。
3.修改构造函数,可以不使用new就能实例化。
4.组合了透明度变化
发表评论
-
[javascript]9宫格拖拽拼图游戏 puzzle
2012-04-29 09:51 15671.跨浏览器,主流浏览器都可以运行2.纯javascript开 ... -
避免悲剧 密码生成器
2011-12-22 15:35 739最近被暴库的很多,密码安全成为重大问题!如何避免简单密码呢?还 ... -
jQuery创建实例与原型继承揭秘
2011-12-20 23:57 759在普通情况下 ... -
[Javascript]单例模式(singleton )
2011-12-16 15:23 1311Javascript中大家都很习惯用new运算符创建实例。现在 ... -
javascript1.7新语法
2011-12-13 18:30 8661.yield 关键字 Yield的作用与return 差不多 ... -
javascript undo redo
2011-12-09 10:55 2374在浏览器中用调试工具看调用结果 <!DOCTYPE ... -
duffsDevice 高速版
2011-11-25 17:21 785function duffsDevice(items, f ... -
ECMAScript.js2
2011-11-07 11:18 1323package { public native functio ... -
仅限正整数输入
2011-10-27 15:35 864修正了拖拽文本进输入框问题 2011.11.14 &l ... -
Another JavaScript quiz
2011-08-19 18:34 638测试题来自《Another JavaScript quiz》P ... -
跨浏览器可8方向拖拽剪裁框
2011-08-15 20:01 869<!DOCTYPE html PUBLIC &quo ... -
选项卡
2011-08-12 17:36 889<!DOCTYPE html PUBLIC &quo ... -
scroll base
2011-08-04 14:25 886开发版,水平方向已完成,垂直方向没测,可以跨浏览,滚动多个当前 ... -
拖拽排序列表单例
2011-07-27 11:17 1167<!DOCTYPE html PUBLIC &quo ... -
很棒的时间线控件
2011-06-24 18:52 1636原生态javascript,希望大家能喜欢 functio ... -
fade方法
2011-05-27 10:12 768function fadeOut(steps){ ... -
核心只要两行即可实现添加或移除className
2011-04-29 11:10 1741<div id="abc" cl ... -
让函数有记忆能力
2011-04-28 15:34 682function addEvent(elem,evType ... -
可以跳动的手风琴 Accordion
2011-04-13 15:02 761<!DOCTYPE html PUBLIC &q ... -
javascript new 关键字的运行原理
2011-04-06 17:33 1533function javascriptNew(t){ a= ...
相关推荐
animate动画特效重复调用animate动画特效重复调用animate动画特效重复调用
animate css最新4.1.1文件打包下载 制作前端动画效果,GitHub搬运方便下载
Jquery的animate实例 主要用到了animate方法
最新animate.css文件,解压后将里面的animate.css放入vscode即可
jquery animate小用例,jquery animate小用例
animate动画效果插件
Animate.css是某位大牛写好的动画效果集合,需要的时候可以直接下载导入到项目中,在需要的元素上添加相关的类即可使用相对应的动画效果。
animate的源代码,在使用时可以直接引用,方便易用,实现各种过渡动画
下面小编就为大家带来一篇原生js实现jquery函数animate()动画效果的简单实例。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
多媒体应用基础所要求的 animate动画 绩点还不错 4.6 因为多个文件,所以就压缩了,上传的是rar文件。 下载后用win.rar解压了就好。 包括: 平时作业 期末作业,也就是animate动画源程序 《多媒体应用基础》(公选)...
基于vue移动端项目,修改后的swiper.animate.min.js文件,因为官方源码不支持 AMD/CMD/UMD 用法,具体请查看我博客相关文章
animate动画
Adobe Animate CC Classroom in a Book 英文azw3 本资源转载自网络,如有侵权,请联系上传者或csdn删除
swiper.animate.js是swiper提供的swiper结合animate的工具,然而他在vue中使用的话需要做一些修改.只是做了部分修改能使用了就可以了没有做什么大神的工厂模式各种设计,也没那能力.哈哈哈哈,反正能用,我是能用.
swiper加上animate实现整屏网站的滚动效果,很简单,很容易上手,前端不可不知
antv g6 animate
Animate66种效果 66种基于animate.css的CSS消息提示效果 66 CSS effects for notifications using animate.css
actionScript关节运动animate,模拟实现人体关节运动