8种效果的鼠标悬停三维倾斜动画

8种效果的鼠标悬停三维倾斜动画

添加时间:2021-02-05 13:59:14
站长推荐丨赞助论坛,可获取海量资源终身免费下载权限奥!
举报 举报
收藏
预览
附件 附件
  • 模板类型模板类型:transform
  • 模板颜色模板颜色:初级
  • 下载积分下载积分:28 米粒
  • 下载权限下载权限:

    赞助会员

一款8种效果的鼠标悬停三维倾斜动画,每种鼠标悬停的效果都不相同,都有一定的3D视觉差的效果,每种样式都可以自由调整。
8种效果的鼠标悬停三维倾斜动画
分类:css3 > transform 难易:初级

页面的head部分,需引入多个CSS样式文件,代码如下:

<link type="text/css" rel="stylesheet" href="css/normalize.css" />
<link type="text/css" rel="stylesheet" href="css/demo.css" />
<link type="text/css" rel="stylesheet" href="css/pater.css" />
<link type="text/css" rel="stylesheet" href="css/component.css" />
<script type="text/javascript">
	document.documentElement.className = 'js';
</script>

页面的body部分,需设置好各个效果的容器,这里用了多个section标签,代码如下:

<main>
  <section class="content content--c1">
    <a href="#" class="tilter tilter--1">
      <figure class="tilter__figure"> <img class="tilter__image" src="images/1.jpg" alt="img01" />
        <div class="tilter__deco tilter__deco--shine">
          <div></div>
        </div>
        <figcaption class="tilter__caption">
          <h3 class="tilter__title">Tanya Bondesta</h3>
          <p class="tilter__description">Toronto</p>
        </figcaption>
        <svg class="tilter__deco tilter__deco--lines" viewBox="0 0 300 415">
          <path d="M20.5,20.5h260v375h-260V20.5z" />
        </svg>
      </figure>
    </a>
    <a href="#" class="tilter tilter--1">
      <figure class="tilter__figure"> <img class="tilter__image" src="images/2.jpg" alt="img02" />
        <div class="tilter__deco tilter__deco--shine">
          <div></div>
        </div>
        <figcaption class="tilter__caption">
          <h3 class="tilter__title">Walter Anderson</h3>
          <p class="tilter__description">Stockholm</p>
        </figcaption>
        <svg class="tilter__deco tilter__deco--lines" viewBox="0 0 300 415">
          <path d="M20.5,20.5h260v375h-260V20.5z" />
        </svg>
      </figure>
    </a>
  </section>
<!-- 省略部分演示代码 -->
  <section class="content content--c8">
    <a href="#" class="tilter tilter--8">
      <figure class="tilter__figure"> <img class="tilter__image" src="images/15.jpg" alt="img15" />
        <div class="tilter__deco tilter__deco--shine">
          <div></div>
        </div>
        <div class="tilter__deco tilter__deco--overlay"></div>
        <figcaption class="tilter__caption">
          <h3 class="tilter__title">Tanya Bondesta</h3>
          <p class="tilter__description">Toronto</p>
        </figcaption>
        <svg class="tilter__deco tilter__deco--lines" viewBox="0 0 300 415">
          <path d="M20.5,20.5h260v375h-260V20.5z" />
        </svg>
      </figure>
    </a>
    <a href="#" class="tilter tilter--8">
      <figure class="tilter__figure"> <img class="tilter__image" src="images/2.jpg" alt="img02" />
        <div class="tilter__deco tilter__deco--shine">
          <div></div>
        </div>
        <div class="tilter__deco tilter__deco--overlay"></div>
        <figcaption class="tilter__caption">
          <h3 class="tilter__title">Walter Anderson</h3>
          <p class="tilter__description">Stockholm</p>
        </figcaption>
        <svg class="tilter__deco tilter__deco--lines" viewBox="0 0 300 415">
          <path d="M20.5,20.5h260v375h-260V20.5z" />
        </svg>
      </figure>
    </a>
  </section>
</main>

页面的底部,需引入多个JS文件,并设置好每一种效果的鼠标悬停事件响应,代码如下:

<script type="text/javascript" src="js/imagesloaded.pkgd.min.js"></script> 
<script type="text/javascript" src="js/anime.min.js"></script> 
<script type="text/javascript" src="js/main.js"></script> 
<script type="text/javascript">
(function() {
	var tiltSettings = [
	{},
	{
		movement: {
			imgWrapper : {
				translation : {x: 10, y: 10, z: 30},
				rotation : {x: 0, y: -10, z: 0},
				reverseAnimation : {duration : 200, easing : 'easeOutQuad'}
			},
			lines : {
				translation : {x: 10, y: 10, z: [0,70]},
				rotation : {x: 0, y: 0, z: -2},
				reverseAnimation : {duration : 2000, easing : 'easeOutExpo'}
			},
			caption : {
				rotation : {x: 0, y: 0, z: 2},
				reverseAnimation : {duration : 200, easing : 'easeOutQuad'}
			},
			overlay : {
				translation : {x: 10, y: -10, z: 0},
				rotation : {x: 0, y: 0, z: 2},
				reverseAnimation : {duration : 2000, easing : 'easeOutExpo'}
			},
			shine : {
				translation : {x: 100, y: 100, z: 0},
				reverseAnimation : {duration : 200, easing : 'easeOutQuad'}
			}
		}
	},
	{
		movement: {
			imgWrapper : {
				rotation : {x: -5, y: 10, z: 0},
				reverseAnimation : {duration : 900, easing : 'easeOutCubic'}
			},
			caption : {
				translation : {x: 30, y: 30, z: [0,40]},
				rotation : {x: [0,15], y: 0, z: 0},
				reverseAnimation : {duration : 1200, easing : 'easeOutExpo'}
			},
			overlay : {
				translation : {x: 10, y: 10, z: [0,20]},
				reverseAnimation : {duration : 1000, easing : 'easeOutExpo'}
			},
			shine : {
				translation : {x: 100, y: 100, z: 0},
				reverseAnimation : {duration : 900, easing : 'easeOutCubic'}
			}
		}
	},
	{
		movement: {
			imgWrapper : {
				rotation : {x: -5, y: 10, z: 0},
				reverseAnimation : {duration : 50, easing : 'easeOutQuad'}
			},
			caption : {
				translation : {x: 20, y: 20, z: 0},
				reverseAnimation : {duration : 200, easing : 'easeOutQuad'}
			},
			overlay : {
				translation : {x: 5, y: -5, z: 0},
				rotation : {x: 0, y: 0, z: 6},
				reverseAnimation : {duration : 1000, easing : 'easeOutQuad'}
			},
			shine : {
				translation : {x: 50, y: 50, z: 0},
				reverseAnimation : {duration : 50, easing : 'easeOutQuad'}
			}
		}
	},
	{
		movement: {
			imgWrapper : {
				translation : {x: 0, y: -8, z: 0},
				rotation : {x: 3, y: 3, z: 0},
				reverseAnimation : {duration : 1200, easing : 'easeOutExpo'}
			},
			lines : {
				translation : {x: 15, y: 15, z: [0,15]},
				reverseAnimation : {duration : 1200, easing : 'easeOutExpo'}
			},
			overlay : {
				translation : {x: 0, y: 8, z: 0},
				reverseAnimation : {duration : 600, easing : 'easeOutExpo'}
			},
			caption : {
				translation : {x: 10, y: -15, z: 0},
				reverseAnimation : {duration : 900, easing : 'easeOutExpo'}
			},
			shine : {
				translation : {x: 50, y: 50, z: 0},
				reverseAnimation : {duration : 1200, easing : 'easeOutExpo'}
			}
		}
	},
	{
		movement: {
			lines : {
				translation : {x: -5, y: 5, z: 0},
				reverseAnimation : {duration : 1000, easing : 'easeOutExpo'}
			},
			caption : {
				translation : {x: 15, y: 15, z: 0},
				rotation : {x: 0, y: 0, z: 3},
				reverseAnimation : {duration : 1500, easing : 'easeOutElastic', elasticity : 700}
			},
			overlay : {
				translation : {x: 15, y: -15, z: 0},
				reverseAnimation : {duration : 500,easing : 'easeOutExpo'}
			},
			shine : {
				translation : {x: 50, y: 50, z: 0},
				reverseAnimation : {duration : 500, easing : 'easeOutExpo'}
			}
		}
	},
	{
		movement: {
			imgWrapper : {
				translation : {x: 5, y: 5, z: 0},
				reverseAnimation : {duration : 800, easing : 'easeOutQuart'}
			},
			caption : {
				translation : {x: 10, y: 10, z: [0,50]},
				reverseAnimation : {duration : 1000, easing : 'easeOutQuart'}
			},
			shine : {
				translation : {x: 50, y: 50, z: 0},
				reverseAnimation : {duration : 800, easing : 'easeOutQuart'}
			}
		}
	},
	{
		movement: {
			lines : {
				translation : {x: 40, y: 40, z: 0},
				reverseAnimation : {duration : 1500, easing : 'easeOutElastic'}
			},
			caption : {
				translation : {x: 20, y: 20, z: 0},
				rotation : {x: 0, y: 0, z: -5},
				reverseAnimation : {duration : 1000, easing : 'easeOutExpo'}
			},
			overlay : {
				translation : {x: -30, y: -30, z: 0},
				rotation : {x: 0, y: 0, z: 3},
				reverseAnimation : {duration : 750, easing : 'easeOutExpo'}
			},
			shine : {
				translation : {x: 100, y: 100, z: 0},
				reverseAnimation : {duration : 750, easing : 'easeOutExpo'}
			}
		}
	}];

	function init() {
		var idx = 0;
		[].slice.call(document.querySelectorAll('a.tilter')).forEach(function(el, pos) { 
			idx = pos%2 === 0 ? idx+1 : idx;
			new TiltFx(el, tiltSettings[idx-1]);
		});
	}

	// Preload all images.
	imagesLoaded(document.querySelector('main'), function() {
		document.body.classList.remove('loading');
		init();
	});

	// REMOVE THIS!
	// For Demo purposes only. Prevent the click event.
	[].slice.call(document.querySelectorAll('a[href="#"]')).forEach(function(el) {
		el.addEventListener('click', function(ev) { ev.preventDefault(); });
	});

	var pater = document.querySelector('.pater'),
		paterSVG = pater.querySelector('.pater__svg'),
		pathEl = paterSVG.querySelector('path'),
		paths = {default: pathEl.getAttribute('d'), active: paterSVG.getAttribute('data-path-hover')};

	pater.addEventListener('mouseenter', function() {
		anime.remove(pathEl);
		anime({
			targets: pathEl,
			d: paths.active,
			duration: 400,
			easing: 'easeOutQuad'
		});
	});

	pater.addEventListener('mouseleave', function() {
		anime.remove(pathEl);
		anime({
			targets: pathEl,
			d: paths.default,
			duration: 400,
			easing: 'easeOutExpo'
		});
	});
})();
</script>
相关内容推荐
资源求助发帖
查看更多发帖

*

回帖描述:

*

链接类型:

*

下载链接:

密码:
发帖规则:回帖内容为会员之间的私信,普通网友无法查看。
免责声明:回帖中提供的链接内容仅供会员之间学习参考使用,获取内容后请在法律法规范围内使用。回帖提供的内容应符合法律法规要求,不得违反法律法律的要求。
站点权责:回帖内容如违反法律法规,站点有权封停账号使用权利。对用户举报的内容,站点有责任及时删除违规内容。
热点内容推荐
标题:8种效果的鼠标悬停三维倾斜动画

*

描述:
平均回复时间:3-10分钟
规则介绍:悬赏寻求论坛网友分享资源,站点对分享内容的准确性,合法性,版权等没有足够的监管能力。如果您发现资源不正确,无法使用,不符合法律法律等情况,您可以直接举报资源。站长将尽快核实您的举报,并根据情况,采取封号,退换米粒等处理。

*

回帖描述:

*

链接类型:

*

阅读权限:

*

下载链接:

密码:
发帖规则:回帖内容为会员之间的私信,普通网友无法查看。
免责声明:回帖中提供的链接内容仅供会员之间学习参考使用,获取内容后请在法律法规范围内使用。回帖提供的内容应符合法律法规要求,不得违反法律法律的要求。
站点权责:回帖内容如违反法律法规,站点有权封停账号使用权利。对用户举报的内容,站点有责任及时删除违规内容。
  • 背景波浪
  • 背景波浪
  • 波浪
  • 波浪
客服
在线咨询
周一 至 周日 9:00 ~ 22:00
QQ:1326974360
微信:juyoubuluo6688
客服热线
18205485173
工作日 9:00 ~ 18:00
微信扫码咨询
客户服务
欢迎咨询服务
咨询量较多时,请耐心等待
社群

关注公众号

获取更多资讯

扫码进群(QQ)

与更多大牛交流沟通

0.126032s