效果:打开只能看到logo,鼠标放上去,圆盘渐显放大旋转展示出来

知识点:

[html+css]

1.logo水平垂直居中于圆盘内,用到的样式

position: absolute; left: 0; top: 0; bottom: 0; right: 0; margin:auto;

2.放大旋转用transform的scale和rotate,渐显用opacity,动画过度自然用transition

3.背景用rgba的好处:opacity会作用于整个元素和他的子元素,rgba的透明度不会影响他的子元素

[js]

1.每个小图标的位置用数学方法里的sin和cos来计算,注:每个小图标的margin-top和margin-left应为自身宽高一半的负值,才能正确定位

<nav>
  <a href="" class="logo"></a>
  <div class="ring">
    <a href="" class="icon"></a>
<a href="" class="icon"></a>
<a href="" class="icon"></a>
<a href="" class="icon"></a>
<a href="" class="icon"></a>
<a href="" class="icon"></a>
<a href="" class="icon"></a>
<a href="" class="icon"></a>
  </div>
</nav>
<style type="text/css">
nav{ position: relative; width: 256px; height: 256px; border-radius: 50%; margin: 100px auto;}
.ring{ position: relative; width: 256px; height: 256px; border-radius: 50%; margin: 0 auto; background: rgba(0,0,0,.4); transform: scale(0.1)
rotate(-270deg); opacity: 0; transition: all 500ms;}
.ring:hover{ transform: scale(1.1) rotate(0); opacity: 1;}
.logo{ position: absolute; display: block; width: 80px; height: 80px; margin: auto; border: 2px solid #fff; border-radius: 50%; left: 0; top: 0;
bottom: 0; right: 0; background: rgba(0,0,0,.5) url(img/logo.png) no-repeat center;}
.ring a{ position: absolute; display: block; width: 40px; height: 40px; margin-left: -20px; margin-top: -20px; border-radius: 50%;}
.ring a:nth-child(1){ background: url(img/1_28.png) no-repeat top #fff;} //:nth-child()是css3选择器,background-color不能直接写到a里,会被:nth-child()覆盖
.ring a:nth-child(2){ background: url(img/1_29.png) no-repeat top #fff;}
.ring a:nth-child(3){ background: url(img/1_30.png) no-repeat top #fff;}
.ring a:nth-child(4){ background: url(img/1_31.png) no-repeat top #fff;}
.ring a:nth-child(5){ background: url(img/1_32.png) no-repeat top #fff;}
.ring a:nth-child(6){ background: url(img/1_33.png) no-repeat top #fff;}
.ring a:nth-child(7){ background: url(img/1_34.png) no-repeat top #fff;}
.ring a:nth-child(8){ background: url(img/1_35.png) no-repeat top #fff;}
</style>
<script type="text/javascript">
var $icon=$(".icon");
for(var i=0,l=$icon.length;i<l;i++){
  var _left=(50-35*Math.cos(-0.5*Math.PI-2*(1/l)*i*Math.PI)).toFixed(4)+"%";
  var _top=(50+35*Math.sin(-0.5*Math.PI-2*(1/l)*i*Math.PI)).toFixed(4)+"%";
  $icon.eq(i).css({"left":_left,"top":_top});
}
</script>

[css3]圆盘旋转动画的更多相关文章

  1. 15个超强悍的CSS3圆盘时钟动画赏析

    在网页上,特别是个人博客中经常会用到时钟插件,一款个性化的时钟插件不仅可以让页面显得美观,而且可以让访客看到当前的日期和时间.今天我们给大家收集了15个超强悍的圆盘时钟动画,很多都是基于CSS3,也有 ...

  2. css3制作旋转动画

    现在的css3真是强大,之前很多动画都是用jq来实现,但是css3制作的动画要比jq实现起来简单很多,今天呢,我自己也写了一个css旋转动画和大家分享.效果如下面的图片 思路:1.制作之前呢,我们先来 ...

  3. css3立体旋转动画

    demo地址 效果图 在别人网站上看到一个立体旋转的例子,然后突然想到自己前几天学习的css3旋转,就试着做了一个例子,看起来有一些粗糙. html结构很简单: <div> <ul ...

  4. css3 3d旋转动画

    <!doctype html> <html> <head> <meta charset="utf-8"> <title> ...

  5. Css3 3D 旋转动画效果

    需求: 1.一个列表滑动效果为360 旋转 准备: 1.css 基础 2.Css 动画基础animation 3.transform-style概念 4 transform 概念 5 JavaScri ...

  6. CSS3 3D旋转动画代码实例

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  7. CSS3 3D旋转动画菜单

    在线演示 本地下载

  8. CSS3实现3D木块旋转动画

    CSS3实现3D木块旋转动画,css3特效,旋转动画,3D,立体效果,CSS3实现3D木块旋转动画是一款迷人的HTML5+CSS3实现的3D旋转动画. 代码下载:http://www.huiyi8.c ...

  9. 用css3制作旋转加载动画的几种方法

    以WebKit为核心的浏览器,例如Safari和Chrome,对html5有着很好的支持,在移动平台中这两个浏览器对应的就是IOS和Android.最近在开发一个移动平台的web app,那么就有机会 ...

随机推荐

  1. LINUX 自动备份脚本文件

    首先我在/root/backup 目录下建立一个文件夹, #mkdir /root/backup/mysqlbackup 以后在每天五点钟,就会有一个文件保存在这里. 接着新建文件 #vim /roo ...

  2. 设置程序集(dll)引用路径,整洁美观

    static class Program { //设置引用程序集路径 static Program() { AppDomain.CurrentDomain.SetData("PRIVATE_ ...

  3. 详解 Array.prototype.slice.call(arguments)

    首先,slice有两个用法,一个是String.slice,一个是Array.slice,第一个返回的是字符串,第二个返回的是数组 在这里我们看第二个方法 1.在JS里Array是一个类 slice是 ...

  4. s3c2440 移值u-boot-2016.03 第3篇 支持Nor flash 识别

    当选择,NOR flash 启用时,才可以访问 NOR FLASH ./common/board_r.c 364 line:initr_flash()flash_size = flash_init() ...

  5. 双向循环链表的Java版本实现

    1.单项循环列表 单向循环链表是单链表的另一种形式,其结构特点是链表中最后一个结点的指针不再是结束标记,而是指向整个链表的第一个结点,从而使单链表形成一个环.和单链表相比,循环单链表的长处是从链尾到链 ...

  6. JavaScript中,格式化DateTime

    参考 http://www.cnblogs.com/best/p/3537030.html new Date(parseInt(list[i].StudyTime.replace(/\D/igm, & ...

  7. 利用angular与后台的交互

    记录的世界是强大的,不管天南海北还是五湖四海,如果利用angular js与后台的交互.angular js 在api上称为是http服务: 下面咱给一个简单的代码看看:简单的利用后台与前端的tab切 ...

  8. 使用git建立远程仓库,让别人git clone下来

    首先, 如果你的ssh没有安装的话,要安装ssh服务端.ubuntu是很简单 sudo apt-get install openssh-server 1,建立你的git 目录. ourunix@ubu ...

  9. C中测试时间代码

  10. 将B表的字段内容插入到A表字段中

    update hy_b_hacker as h , ( SELECT ( @rowNO := @rowNo +1 ) AS rowno, ip FROM ( SELECT * FROM hy_b_se ...