爱易网
IT新闻
IT新闻
爱易资讯
网站搭建
云虚拟主机教程
云服务器教程
Apache教程
IIS教程
Nginx教程
网站策划
站长文章
推广教程
淘宝客教程
网页设计
HTML教程
XHTML教程
CSS教程
HTML5教程
CSS3教程
JavaSript基础
JQuery教程
Node.js教程
前端技术
Ajax教程
Js特效
Xml教程
平面设计
页面UI设计
photoshop教程
程序开发
AI人工智能
Asp教程
Php教程
Asp.Net教程
Net Core教程
C#教程
Java教程
Jsp教程
开发技术
微信小程序教程
Uniapp开发教程
微信公众号开发
Andriod教程
IOS教程
DOS教程
Python教程
Docker教程
Windows Container教程
数据库
MSSQL教程
MySQL教程
Redis教程
Access教程
Oracle教程
数据库教程
操作系统
Linux教程
Windows教程
MAC教程
Cisco教程
交换机教程
防火墙教程
搜索
爱易网页
JS特效
非常酷的3D翻转相册展示特效
非常酷的3D翻转相册展示特效
日期:2014-05-18 浏览次数:20220 次
以下是程序代码
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title> DHTML特效,非常酷的3D翻转相册展示特效</title> <meta http-equiv="imagetoolbar" content="no"> <style type="text/css"> html { overflow: hidden; } body { position: absolute; margin: 0px; padding: 0px; background: #fff; width: 100%; height: 100%; } #screen { position: absolute; left: 10%; top: 10%; width: 80%; height: 80%; background: #fff; } #screen img { position: absolute; cursor: pointer; width: 0px; height: 0px; -ms-interpolation-mode:nearest-neighbor; } #bankImages { visibility: hidden; } #FPS { position: absolute; right: 5px; bottom: 5px; font-size: 10px; color: #666; font-family: verdana; } </style> <script type="text/javascript"> /* ==== Easing function ==== */ var Library = {}; Library.ease = function () { this.target = 0; this.position = 0; this.move = function (target, speed) { this.position += (target - this.position) * speed; } } var tv = { /* ==== variables ==== */ O : [], fps : 0, screen : {}, angle : { x : new Library.ease(), y : new Library.ease() }, camera : { x : new Library.ease(), y : new Library.ease() }, create3DHTML : function (i, x, y, z, sw, sh) { /* ==== create HTML image element ==== */ var o = document.createElement('img'); o.src = i.src; tv.screen.obj.appendChild(o); /* ==== 3D coordinates ==== */ o.point3D = { x : x, y : y, z : new Library.ease(), sw : sw, sh : sh, w : i.width, h : i.height }; o.point3D.z.target = z; /* ==== push object ==== */ o.point2D = {}; tv.O.push(o); /* ==== on mouse over event ==== */ o.onmouseover = function () { if (this != tv.o) { this.point3D.z.target = tv.mouseZ; tv.camera.x.target = this.point3D.x; tv.camera.y.target = this.point3D.y; if (tv.o) tv.o.point3D.z.target = 0; tv.o = this; } return false; } /* ==== on mousedown event ==== */ o.onmousedown = function () { if (this == tv.o) { if (this.point3D.z.target == tv.mouseZ) this.point3D.z.target = 0; else { tv.o = false; this.onmouseover(); } } } /* ==== main 3D function ==== */ o.animate = function () { /* ==== 3D coordinates ==== */ var x = this.point3D.x - tv.camera.x.position; var y = this.point3D.y - tv.camera.y.position; this.point3D.z.move(this.point3D.z.target, this.point3D.z.target ? .15 : .08); /* ==== rotations ==== */ var xy = tv.angle.cx * y - tv.angle.sx * this.point3D.z.position; var xz = tv.angle.sx * y + tv.angle.cx * this.point3D.z.position; var yz = tv.angle.cy * xz - tv.angle.sy * x; var yx = tv.angle.sy * xz + tv.angle.cy * x; /* ==== 2D transform ==== */ var scale = tv.camera.focalLength / (tv.camera.focalLength + yz); x = yx * scale; y = xy * scale; var w = Math.round(Math.max(0, this.point3D.w * scale * this.point3D.sw)); var h = Math.round(Math.max(0, this.point3D.h * scale * this.point3D.sh)); /* ==== HTML rendering ==== */ var o = this.style; o.left = Math.round(x + tv.screen.w - w * .5) + 'px'; o.top = Math.round(y + tv.screen.h - h * .5) + 'px'; o.width = w + 'px'; o.height = h + 'px'; o.zIndex = 10000 + Math.round(scale * 1000); } }, /* ==== init script ==== */ init : function (structure, FL, mouseZ, rx, ry) { this.screen.obj = document.getElementById('screen'); this.screen.obj.onselectstart = function () { return false; } this.screen.obj.ondrag = function () { return false; } this.mouseZ = mouseZ; this.camera.focalLength = FL; this.angle.rx = rx; this.angle.ry = ry; /* ==== create objects ==== */ var i = 0, o; while( o = structure[i++] ) this.create3DHTML(o.img, o.x, o.y, o.z, o.sw, o.sh); /* ==== start script ==== */ this.resize(); mouse.y = this.screen.y + this.screen.h; mouse.x = this.sc
上一篇:狡猾的按钮特效
下一篇:鼠标经过图片上时,图片突出显示特效
免责声明:
本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
相关资料
更多>
杨元庆去年总薪酬1.33亿元
京东封杀财付通:终极目标是电商生态圈
京东很忙:升服务推产品更新招股书 能赶在阿里前上市?
苹果CEO抱歉解读:是战略而非“屈服”
火一把就死: 百度魔图验证社交游戏衰亡宿命
《中国三网融合业务运营管理》研讨报告征订函
盛大游戏走向衰落的根源:免费游戏模式惹的祸
英特尔技术高管离任 电视业务或受影响
牟贵先挂帅 国美在线“价钱战”昔日开打
推荐阅读
更多>
工商总局开查电商“七日退货”
靠谱分析:6月发生的WWDC和谷歌I/O大会,将会出现哪些新产品?
只有切到刚需痛点,漫画APP才能走下去
刘强东:京东上市融资用于开拓三至六线城市
史玉柱卸任巨人网络CEO 继位人选引猜想
酷派首抓4G时机大丰收,未来份额必降无疑
网曝富士康“二连跳” 疑因推静音模式
第二梯队也PK:当1号店“遇上”京东手机节
神州电脑中止IPO面前:再被质疑财务造假
纸媒深探版权蓝海抗衡互联网的时机到来了
微信企业号必须搬走四座大山,否则只能铩羽而归!
联通丹东公司一高管造假套出手机变卖被判刑7年
工商下月将整治手机市场
迪信通神秘免费服务揭谜底:充电宝免费带回家
三星手机在国内陷入困境:华为中兴小米紧追
华为、小米和联想在中国手机市场上演“三国杀”
MIUI,有了它小米就无惧对手
华为任正非:家族成员不会成为接班人
京东确定IPO定价区间 最高募资16.9亿美元
NoomWeight减肥