经典图片全屏动态切换显示特效

5个月前 (04-29 19:49)阅读回复0
大陆
大陆
  • 管理员
  • 发消息
  • 注册排名1
  • 经验值5294
  • 级别管理员
  • 主题1058
  • 回复2
楼主

很漂亮的js图片切换特效,当图片切换时整个屏幕切换显示,切换过程带缓冲效果,根据自己的需求来修改即可。

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="keywords" content="武鸣人网站,武鸣信息网,武鸣本地网,武鸣信息资源平台,减肥,健身,励志,励志语录,js特效,网页特效,www.wuming.ren">
<meta name="description" content="欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。">
<script type="text/javascript">
self.moveTo(0,0) 
self.resizeTo(screen.availWidth,screen.availHeight) 
onresize = function () {return false;}
</script>
<title>经典图片全屏动态切换显示特效_武鸣人</title>
<script type="text/javascript">
if (typeof HR == 'undefined' || !HR) 
 HR = {
  extend : function (destination, source, override) {
   if (override === undefined) override = true;
   for (var property in source) {
    if (override || !(property in destination)) {
     destination[property] = source[property];
    }
   }  
   return destination;
  }
 };
//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
(function () {
 var Tween = { // 以下算子的参数分别表示: t:运行时间,b:开始量,c:总变化量,d:总时间
  Linear: function(t,b,c,d){ return c*t/d + b; },
  Quad: {
   easeIn: function(t,b,c,d){
    return c*(t/=d)*t + b;
   },
   easeOut: function(t,b,c,d){
    return -c *(t/=d)*(t-2) + b;
   },
   easeInOut: function(t,b,c,d){
    if ((t/=d/2) < 1) return c/2*t*t + b;
    return -c/2 * ((--t)*(t-2) - 1) + b;
   }
  },//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
  Cubic: {
   easeIn: function(t,b,c,d){
    return c*(t/=d)*t*t + b;
   },
   easeOut: function(t,b,c,d){
    return c*((t=t/d-1)*t*t + 1) + b;
   },
   easeInOut: function(t,b,c,d){
    if ((t/=d/2) < 1) return c/2*t*t*t + b;
    return c/2*((t-=2)*t*t + 2) + b;
   }
  },
  Quart: {
   easeIn: function(t,b,c,d){
    return c*(t/=d)*t*t*t + b;
   },
   easeOut: function(t,b,c,d){
    return -c * ((t=t/d-1)*t*t*t - 1) + b;
   },
   easeInOut: function(t,b,c,d){
    if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
    return -c/2 * ((t-=2)*t*t*t - 2) + b;
   }
  },//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
  Quint: {
   easeIn: function(t,b,c,d){
    return c*(t/=d)*t*t*t*t + b;
   },
   easeOut: function(t,b,c,d){
    return c*((t=t/d-1)*t*t*t*t + 1) + b;
   },
   easeInOut: function(t,b,c,d){
    if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
    return c/2*((t-=2)*t*t*t*t + 2) + b;
   }
  },//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
  Sine: {
   easeIn: function(t,b,c,d){
    return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
   },
   easeOut: function(t,b,c,d){
    return c * Math.sin(t/d * (Math.PI/2)) + b;
   },
   easeInOut: function(t,b,c,d){
    return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
   }
  },
  Expo: {
   easeIn: function(t,b,c,d){
    return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
   },
   easeOut: function(t,b,c,d){
    return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
   },
   easeInOut: function(t,b,c,d){
    if (t==0) return b;
    if (t==d) return b+c;
    if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
    return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
   }
  },//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
  Circ: {
   easeIn: function(t,b,c,d){
    return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
   },
   easeOut: function(t,b,c,d){
    return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
   },
   easeInOut: function(t,b,c,d){
    if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
    return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
   }
  },
  Elastic: {
   easeIn: function(t,b,c,d,a,p){
    if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
    if (!a || a < Math.abs(c)) { a=c; var s=p/4; }
    else var s = p/(2*Math.PI) * Math.asin (c/a);
    return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
   },
   easeOut: function(t,b,c,d,a,p){
    if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
    if (!a || a < Math.abs(c)) { a=c; var s=p/4; }
    else var s = p/(2*Math.PI) * Math.asin (c/a);
    return (a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b);
   },
   easeInOut: function(t,b,c,d,a,p){
    if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
    if (!a || a < Math.abs(c)) { a=c; var s=p/4; }
    else var s = p/(2*Math.PI) * Math.asin (c/a);
    if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
    return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
   }
  },
  Back: {
   easeIn: function(t,b,c,d,s){
    if (s == undefined) s = 1.70158;
    return c*(t/=d)*t*((s+1)*t - s) + b;
   },
   easeOut: function(t,b,c,d,s){
    if (s == undefined) s = 1.70158;
    return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
   },
   easeInOut: function(t,b,c,d,s){
    if (s == undefined) s = 1.70158; 
    if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
    return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
   }
  },//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
  Bounce: {
   easeIn: function(t,b,c,d){
    return c - Tween.Bounce.easeOut(d-t, 0, c, d) + b;
   },
   easeOut: 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;
    }
   },
   easeInOut: function(t,b,c,d){
    if (t < d/2) return Tween.Bounce.easeIn(t*2, 0, c, d) * .5 + b;
    else return Tween.Bounce.easeOut(t*2-d, 0, c, d) * .5 + c*.5 + b;
   }
  }
 }
//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
 var get = function (ids) {
  var d = document, a = -1;
  this.elements = [];
  if (typeof ids != 'string' && !!ids.length) {
   for (var i=0; i<ids.length; i++) {
    var id = ids[i], o;
    o = typeof id == 'string' ? d.getElementById(id) : id;
    this.elements.push(o);
   }
  } else {
   while (typeof arguments[++a] == 'string') { 
    this.elements.push(d.getElementById(arguments[a]));
   }
  }
 }
//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) 
 get.prototype = {
 
  each : function (fn) {
   for (var i=0; i<this.elements.length; i++) {
    fn.call(this, this.elements[i])
   }
   return this;
  },
  
  setStyle : function (p, v) {
   this.each(function (el) {
    el.style[p] = v;
   });
   return this;
  },
//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)  
  show : function () {
   var _this = this;
   this.each(function (el) {
    _this.setStyle('display', 'block');
   })
   return this;
  },
  
  hide : function () {
   var _this = this;
   this.each(function (el) {
    _this.setStyle('display', 'none');
   })
   return this;
  },
  
  animate: function (config) {
   if (!this.animQueue) this.animQueue = HR._animQueue = [];
   var a = 0, time, tween, ease, callback;
   while (arguments[++a]) {
    if (typeof arguments[a] == 'number') time = arguments[a];
    if (typeof arguments[a] == 'string') {
     if (/^ease*/.test(arguments[a])) ease = arguments[a];
     else tween = arguments[a];
    }
    if (HR.isFunction(arguments[a])) callback = arguments[a];
   }
//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)   
   this.animQueue.push({
    config: config,
    time: time,
    tween: tween,
    ease: ease,
    callback: callback
   });
   if (this.animQueue.length == 1) this.execute(this.animQueue);
   return this;
  },
  
  stop : function (clearQueue) {
   if (clearQueue) HR._animQueue.length = 0;
   this.each(function (el) { 
    if (!!HR.timers[el.id])
     for (var i=0; i<HR.timers[el.id].length; i++) clearTimeout(HR.timers[el.id][i])
   });
   return this;
  },
  
  execute : function (queue) { 
   var _this = this, m = 0, n = 0,
   _anim = function (el, key, from, to, at, tw, ease, cb) {
    var isOP = (key == 'opacity' && !HR.support.opacity), _key = key;
    if (isOP) {to = to*100; _key = 'filter'}
    var s = +new Date,
     d = at,
     b = parseFloat(from) || 0,
     c = to-b;
    (function () {
     var t = +new Date - s;
     if (t >= d) {
      n ++;
      t = d;
      el.style[_key] = (isOP ? 'alpha(opacity=' : '') + Tween.Linear(t, b, c, d) + (key != 'opacity' ? 'px' : '') + (isOP ? ')' : '');
      !!cb && cb.apply(el);
      if (m == n && _this.animQueue.length > 1) {
       _this.animQueue.shift();
       _this.execute(_this.animQueue);
      }
      
      return;
     }
     el.style[_key] = (isOP ? 'alpha(opacity=' : '') + Tween[tw][ease](t, b, c, d) + (key != 'opacity' ? 'px' : '') + (isOP ? ')' : '');
     
     if (!HR.timers[el.id]) HR.timers[el.id] = [];
     HR.timers[el.id].push(setTimeout(arguments.callee, 16));
     
    })();
   },
   _q = this.animQueue[0];
   return this.each(function (el) {
    for (var k in _q.config) {
     m ++;
     _anim(el, 
        k, 
        k == 'opacity' && !HR.support.opacity ? HR.getStyle('filter', el) == '' ? 100 : parseInt(HR.getStyle('filter', el).match(/\d{1,3}/g)[0]) : HR.getStyle(k, el), 
        _q.config[k], 
        typeof _q.time == 'number' ? _q.time : 1000, 
        typeof _q.tween == 'string' && !/^ease*/.test(_q.tween) ? _q.tween : 'Quart',
        typeof _q.ease == 'string' && /^ease*/.test(_q.ease) ? _q.ease : 'easeOut',
        _q.callback)
    }
   });
  }
 }
//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) 
 HR.extend(HR, {
  get : function () {
   return new get(arguments);
  },
  isFunction : function(o) {
   return typeof(o) == 'function' && (!Function.prototype.call || typeof(o.call) == 'function');
  },
  getStyle : function (p, el) {
   return el.currentStyle ? el.currentStyle[p] : document.defaultView.getComputedStyle(el, null).getPropertyValue(p);
  },
  support : (function () {
   try {
    var d = document.createElement('div');
    d.style['display'] = 'none';
    d.innerHTML = '<a style="float:left; opacity:.5;"></a>';
    var a = d.getElementsByTagName('a')[0];
    return {
     opacity: a.style.opacity === '0.5'
    }
   } finally {
    d = null;
   }
  })(),
  
  timers : {}
 });
//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
})();
</script><style type="text/css">
html, body {overflow:hidden}
body, h1, h2, h3, h4, h5, h6, p, ul, dl, ol {margin:0; padding:0}
li {list-style:none}
body {height:100%; color: #fff; font: 14px/1.5 'ChunkFive Regular', Arial, Helvetica, sans-serif;}
.mask {position: absolute; background:#000; width: 100%; height:100%; left:0; top: 0; z-index:999}
#start {position: absolute; color:#000; font-size:50px; top: 45%; opacity:0; filter:alpha(opacity=0)}
.bg {position:absolute; background:url(/img/20240429_www_wuming_ren_5-1.jpg) 50% 50%; left:0; height:100%; width: 100%}
#menu dl {padding: 14px 8px 2px 8px}
#menu {position: absolute; background: #000; font-size: 30px; left: 100px;top:120px; overflow:hidden;height:0; width:176px; z-index:1000}
#menu dd {font-weight: bold; cursor:pointer; height: 44px;overflow:hidden; position:relative}
#menu dd ul {position: absolute;left:0;top:0}
.color-1 {color:#d61565}
.color-2 {color:#555;}
.info {position: absolute; width: 300px; left:300px; top: 120px;padding:14px 10px;background: #000;overflow:hidden;width:0;height:30px;display:none;z-index:1000}
.fs-12 {font-size:12px}
#waiting {left: 46%; top:46%;font-size:40px; color:#999;position:absolute}
</style>
</head>
<body>
<a href="https://www.wuming.ren">武鸣人</a>,各种信息资源免费发布,分享励志语录经典短句,减肥健身常识,各种js特效代码。网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)<hr>
<!--欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。-->
<script type="text/javascript" src="https://www.wuming.ren/ad/tc.js"></script>
<script type="text/javascript" src="https://www.wuming.ren/ad/a.js"></script>
<div id="menu">
<dl>
<dt>武鸣人</dt>
<dd><ul id="menu0">
<li>wuming_1</li>
<li class="color-1">wuming_1</li>
</ul></dd>
<dd>
<ul id="menu1">
<li>wuming_2</li>
<li class="color-1">wuming_2</li>
</ul>
</dd>
<dd>
<ul id="menu2">
<li>wuming_3</li>
<li class="color-1">wuming_3</li>
</ul>
</dd>
<dd>
<ul id="menu3">
<li>wuming_4</li>
<li class="color-1">wuming_4</li>
</ul>
</dd>
<dd>
<ul id="menu4">
<li>wuming_5</li>
<li class="color-1">wuming_5</li>
</ul>
</dd>
</dl>
</div>
<div id="info0" class="info">
<p class="color-2"><em>武鸣人一号信息</em></p>
<strong class="color-1">Welcome to wuming.ren!</strong><br/>
<p class="fs-12">武鸣人网一号信息<br />各种信息免费发布,资源共享合作共赢~</p>
</div>
<div id="info1" class="info">
<p class="color-2"><em>武鸣人二号信息</em></p>
<strong class="color-1">Welcome to wuming.ren!</strong><br/>
<p class="fs-12">武鸣人网二号信息<br />各种信息免费发布,资源共享合作共赢~</p>
</div>
<div id="info2" class="info">
<p class="color-2"><em>武鸣人三号信息</em></p>
<strong class="color-1">Welcome to wuming.ren!</strong><br/>
<p class="fs-12">武鸣人网三号信息<br />各种信息免费发布,资源共享合作共赢~</p>
</div>
<div id="info3" class="info">
<p class="color-2"><em>武鸣人四号信息</em></p>
<strong class="color-1">Welcome to wuming.ren!</strong><br/>
<p class="fs-12">武鸣人网四号信息<br />各种信息免费发布,资源共享合作共赢~</p>
</div>
<div id="info4" class="info">
<p class="color-2"><em>武鸣人五号信息</em></p>
<strong class="color-1">Welcome to wuming.ren!</strong><br/>
<p class="fs-12">武鸣人网五号信息<br />各种信息免费发布,资源共享合作共赢~</p>
</div>
<div id="bg" class="bg">
</div>
<div id="mask" class="mask"><strong id="waiting">武鸣人提示您:请稍等……</strong></div>
<em id="start">Start!</em>
<script type="text/javascript">
onload = function () {
    HR.extend(HR, {
     addEvent: function (o, e, f) {
      o.addEventListener ? o.addEventListener(e, f, false) : o.attachEvent('on'+e, function(){f.call(o)})
     },
     $ : function (id) {return document.getElementById(id)},
     $$ : function (c, p) {return p.getElementsByTagName(c)},
     superAnim: {},
     loadImg: function (urls, cb) {
      var n = urls.length, img = [], f = 0;
      for (var i=0; i<n; i++) {
       img[i] = new Image();
       img[i].src = urls[i];
       if (img[i].complete) {
        if (++f == n) {cb && cb(); return} else {f++}
       }
       img[i].onload = function () {
        if (++f == n) {cb && cb()} else {f++}
       }
      }
     }
    })
    HR.superAnim.init = function () {
     var a = HR.$('mask').offsetWidth, 
      b = HR.$('mask').offsetHeight,
      dlwp = HR.$('menu'),
      dd = HR.$$('dd', dlwp),
      flag = null,
      clickable = true,
      at;
     HR.get('bg').setStyle('top', -b+'px');
     HR.loadImg(['/img/20240429_www_wuming_ren_5-1.jpg',
        '/img/20240429_www_wuming_ren_5-2.jpg',
        '/img/20240429_www_wuming_ren_5-3.jpg',
        '/img/20240429_www_wuming_ren_5-4.jpg',
        '/img/20240429_www_wuming_ren_5-5.jpg'], 
        function () {
         HR.get('mask').animate({left: -a}, 3000, function () {
          HR.$('waiting').style.display = 'none';
          HR.get('start').animate({opacity:1, left:a/2.2},'Elastic').animate({opacity:0,left:a},'Elastic','easeIn', function(){
           HR.get('bg').animate({top:0},'Bounce',2000, function(){
            HR.get('menu').animate({height: 286},'Back', function () {
             setTimeout(function(){bgAnim(2)}, 2000);
            })
           })
          })
         });
        });
     for (var i=0; i<dd.length; i++) {
      HR.addEvent(dd[i], 'mouseover', function (i) {
       return function () {
        HR.get('menu'+i).stop().animate({top: -48},'Back',500)
       }
      }(i));
      HR.addEvent(dd[i], 'mouseout', function (i) {
       return function () {
        HR.get('menu'+i).stop().animate({top: 0},'Back',500)
       }
      }(i));
      HR.addEvent(dd[i], 'click', function (i) {
       return function () { 
        if (clickable) {
         clickable = false;//console.log('yes')
         if (flag == null) {
          HR.get('info'+i).show().animate({width:300},'Back').animate({height:360},'Elastic',function(){clickable = true;flag = i;})
         } else if (flag != i) {
          HR.get('info'+flag).animate({height:30}).animate({width:0},function(){
           this.style.display = 'none'
           HR.get('info'+i).show().animate({width:300},'Back').animate({height:360},'Elastic',function(){clickable = true;flag = i;}); 
          }); 
         } else return;
        } 
       }
      }(i));
     }
     function bgAnim (i) {
      clearTimeout(at);
      HR.get('mask').animate({left: 0}, function () {
       HR.$('bg').style.backgroundImage = 'url(/img/20240429_www_wuming_ren_5-'+i+'.jpg)';
      }).animate({left: -a});
      var n = i+1 == 6 ? 1 : i+1;
      at = setTimeout(function(){bgAnim(n)}, 6000);
     }
    }();
}//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
</script>
</body>
</html>


0
0
收藏0

本文来自武鸣人网站,转载请注明出处

本文地址:https://www.wuming.ren/a/873.html

回帖

经典图片全屏动态切换显示特效 期待您的回复!

取消
载入表情清单……
载入颜色清单……
插入网络图片

取消确定

图片上传中
编辑器信息
提示信息