jsAnim简单使用教程
2018-06-24 02:08:49来源:未知 阅读 ()
- 引入jsAnim.js
- 定义动画元素 元素需要有position:relative;或者position:absolute;属性
- 添加js
-
<!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8"> <title></title> <script type="text/javascript" src="jsAnim.js"></script> <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/1.9.0/jquery.min.js"></script> <style type="text/css"> #mushroom{position:relative;}/*动画元素的重要属性*/ </style> </head> <body> <img id="mushroom" src="E:\图片\bei.png" alt="" /> <div> <button id="do1">你好</button><button id="do2">你好</button> </div> <script type="text/javascript"> var manager = new jsAnimManager(); //声明jsadmin管理对象 $("#do1").click(function(){ manager.registerPosition("mushroom"); //向jsadmin注册动画元素 shroom = document.getElementById("mushroom"); //声明变量获得动画元素 shroom.setPosition(-250,25); //设置动画元素的初始位置 var anim = manager.createAnimObject("mushroom"); //jsadmin创建动画 var anim1 = manager.createAnimObject("mushroom"); var anim2 = manager.createAnimObject("mushroom"); anim.add({property: Prop.position, to: new Pos(250,25), duration: 2000, onComplete: function() {alert("HEY!")}}); //开始最终执行动画效果,详细全部效果可通过查看jsadmin源文件 <!-- anim1.add({property: Prop.position, to: new Pos(250,75), --> <!-- duration: 2000}); --> <!-- anim2.add({property: Prop.dimension, to: new Dim(140,20), --> <!-- duration: 2000}); --> }) $("#do2").click(function(){ manager.registerPosition("mushroom"); shroom = document.getElementById("mushroom"); //shroom.setPosition(-250,25); var anim = manager.createAnimObject("mushroom"); anim.add({property: Prop.left, to: 500, duration: 2000}); anim.add({property: Prop.position, to: new Pos(250,25), duration: 2000}); anim.add({property: Prop.wait, duration: 1000}); anim.add({property: Prop.position, to: new Pos(0,100), duration: 2000}); anim.add({property: Prop.backgroundColor, to: new Col(00,255,133), duration:2000}); anim.add({property: Prop.positionCircle(true), to: new Pos(0,100), duration: 2000}); anim.add({property: Prop.position, to: new Pos(250,25), duration: 2000}); anim.add({property: Prop.position, to: new Pos(250,100), duration: 2000}); anim.add({property: Prop.positionSemicircle(false), to: new Pos(250,25), duration: 2000}); }) </script> </body> </html>
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
上一篇:react-redux源码解析
下一篇:选择排序和插入排序--学习笔记
- 关于jQuery UI 使用心得及技巧 2020-03-29
- js中去掉字串左右空格 2020-03-20
- Js中如何使用sort() 2020-03-18
- JS简单去除数组中重复项的方法 2020-03-16
- JS判断浏览器是否安装flash插件的简单方法 2020-03-12
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash