布局框架

Windows8 风格打开面板动画UI设计

阿里云


这是一款仿 windows 8 Metro 风格的布局和面板打开动画 UI 设计效果。该 UI 设计以扁平风格为主,将面板的缩略图以网格的方式布局。在用户点击某个缩略图后,该缩略图对应的面板会旋转放大到全屏,效果非常的炫酷。Metro 是微软在 Windows Phone 7 中正式引入的一种界面设计语言,也是 Windows 8 的主要界面显示风格。在 Windows Phone 之前,微软已经在 Zune Player 和 XBox 360 主机中尝试采用过类似的界面风格,并得到了用户的广泛认可。于是,微软在新发布的 Windows Phone 7、已经发布的 Windows 8、Windows 8.1 以及 Office 15 中也采用了 Metro 设计。今后的微软产品中将更多的能看到 Metro 的影子,而更少的看到传统的 Windows 视窗界面。

HTML 结构

该 windows 8 Metro 风格 UI 设计的 HTML 结构使用一个无序列表来制作网格布局,里面放置的是各个面板。div.box 是打开的全屏面板。

也想出现在这里?联系我们
创客主机
  1. <ul class="metro">
  2.   <li><i class="fa fa-gamepad"></i><span>Games</span></li>
  3.   <li><i class="fa fa-cogs"></i><span>Settings</span></li>
  4.   <li><i class="fa fa-envelope-o"></i><span>Email</span></li>
  5.   <li><i class="fa fa-comments-o"></i><span>Messages</span></li>
  6.   <li><i class="fa fa-music"></i><span>Music</span></li>
  7.   <li><i class="fa fa-heart-o"></i><span>Favorites</span></li>
  8.   <li><i class="fa fa-picture-o"></i><span>Photos</span></li>
  9. </ul>
  10.  
  11. <div class="box">
  12.   <span class="close"></span>
  13.   <p></p>
  14. </div>

CSS 样式

在无序列表的网格布局中,为制作透视效果,每一个列表项都设置了 perspective 属性。

  1. .metro li {
  2.     -webkit-transform: perspective(600px);
  3.     -webkit-transform-style: preserve-3d;
  4.     -webkit-transform-origin-x: 50%;
  5.     -webkit-transform-origin-y: 50%;
  6.     -ms-transform: perspective(600px);
  7.     -ms-transform-style: preserve-3d;
  8.     -ms-transform-origin-x: 50%;
  9.     -ms-transform-origin-y: 50%;
  10.     transform: perspective(600px);
  11.     transform-style: preserve-3d;
  12.     transform-origin-x: 50%;
  13.     transform-origin-y: 50%;
  14.     cursor: default;
  15.     position: relative;
  16.     text-align: center;
  17.     margin: 0 10px 10px 0;
  18.     width: 150px;
  19.     height: 150px;
  20.     color: #ffffff;
  21.     float: left;
  22.     -webkit-transition: .2s -webkit-transform, 1s opacity;
  23.     -ms-transition: .2s -ms-transform, 1s opacity;
  24.     transition: .2s transform, 1s opacity;
  25.     cursor:pointer;
  26. }

x 和 y 方向上的转换原点都被设置为 50%,这是为了在点击小面板时制作 3D 效果,你会发现鼠标点击不同的小面板不松开时,会有不同的 3D 转换效果。这是通过 nth-child 选择器和不同的 transform 来配合完成的。

  1. .metro li:nth-child(5):active, .metro li:first-child:active {
  2.     -webkit-transform: scale(0.95);
  3.     -ms-transform: scale(0.95);
  4.     transform: scale(0.95);
  5. }
  6.  
  7. .metro li:nth-child(7):active, .metro li:nth-child(2):active {
  8.     -webkit-transform: perspective(600px) rotate3d(1, 0, 0, -10deg);
  9.     -ms-transform: perspective(600px) rotate3d(1, 0, 0, -10deg);
  10.     transform: perspective(600px) rotate3d(1, 0, 0, -10deg);
  11. }
  12.  
  13. .metro li:nth-child(3):active {
  14.     -webkit-transform: perspective(600px) rotate3d(0, 1, 0, 10deg);
  15.     -ms-transform: perspective(600px) rotate3d(0, 1, 0, 10deg);  
  16.     transform: perspective(600px) rotate3d(0, 1, 0, 10deg); 
  17. }
  18.  
  19. .metro li:nth-child(4):active {
  20.     -webkit-transform: perspective(600px) rotate3d(0, 1, 0, -10deg);
  21.     -ms-transform: perspective(600px) rotate3d(0, 1, 0, -10deg);
  22.     transform: perspective(600px) rotate3d(0, 1, 0, -10deg);
  23. }
  24.  
  25. .metro li:nth-child(6):active {
  26.     -webkit-transform: perspective(600px) rotate3d(1, 0, 0, 10deg);
  27.     -ms-transform: perspective(600px) rotate3d(1, 0, 0, 10deg);
  28.     transform: perspective(600px) rotate3d(1, 0, 0, 10deg);
  29. }

在大面板.box 的打开动画中,也是使用了旋转和缩放,配合适当的过渡动画来制作出 3D 效果。

  1. .box {
  2.     display: table;
  3.     top: 0;
  4.     visibility: hidden;
  5.     -webkit-transform: perspective(1200px) rotateY(180deg) scale(0.1);
  6.     -ms-transform: perspective(1200px) rotateY(180deg) scale(0.1);
  7.     transform: perspective(1200px) rotateY(180deg) scale(0.1);
  8.     top: 0;
  9.     left: 0;
  10.     z-index: -1;
  11.     position: absolute;
  12.     width: 100%;
  13.     height: 100%;
  14.     opacity: 0;
  15.     transition: 1s all;
  16. }
  17. .box.open {
  18.     left: 0;
  19.     top: 0;
  20.     visibility: visible;
  21.     opacity: 1;
  22.     z-index: 999;
  23.     -webkit-transform: perspective(1200px) rotateY(0deg) scale(1);
  24.     -ms-transform: perspective(1200px) rotateY(0deg) scale(1);
  25.     transform: perspective(1200px) rotateY(0deg) scale(1);
  26.     width: 100%;
  27.     height: 100%;
  28. }

JavaScript

你会发现点击不同颜色的小面板时打开的大面板和小面板的颜色是相同的,这是在 jQuery 代码中实现的,代码中还会为打开的面板添加.openclass 和添加文本内容。
$(document).ready(function () {
var $box = $('.box');
$('.metro li').each(function () {
var color = $(this).css('backgroundColor');
var content = $(this).html();
$(this).click(function () {
$box.css('backgroundColor', color);
$box.addClass('open');
$box.find('p').html(content);
});
$('.close').click(function () {
$box.removeClass('open');
$box.css('backgroundColor', 'transparent');
});
});
});

Windows8 风格打开面板动画 UI 设计

已有 358 人购买
查看演示升级 VIP立刻购买

演示地址 下载地址
收藏
(0)

发表回复

热销模板

Ashade - 作品展示摄影相册WordPress汉化主题
LensNews

本站承接 WordPress / PbootCMS / DedeCMS 等
系统建站、仿站、开发、定制等业务!