[css3]圆盘旋转动画
效果:打开只能看到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]圆盘旋转动画的更多相关文章
- 15个超强悍的CSS3圆盘时钟动画赏析
在网页上,特别是个人博客中经常会用到时钟插件,一款个性化的时钟插件不仅可以让页面显得美观,而且可以让访客看到当前的日期和时间.今天我们给大家收集了15个超强悍的圆盘时钟动画,很多都是基于CSS3,也有 ...
- css3制作旋转动画
现在的css3真是强大,之前很多动画都是用jq来实现,但是css3制作的动画要比jq实现起来简单很多,今天呢,我自己也写了一个css旋转动画和大家分享.效果如下面的图片 思路:1.制作之前呢,我们先来 ...
- css3立体旋转动画
demo地址 效果图 在别人网站上看到一个立体旋转的例子,然后突然想到自己前几天学习的css3旋转,就试着做了一个例子,看起来有一些粗糙. html结构很简单: <div> <ul ...
- css3 3d旋转动画
<!doctype html> <html> <head> <meta charset="utf-8"> <title> ...
- Css3 3D 旋转动画效果
需求: 1.一个列表滑动效果为360 旋转 准备: 1.css 基础 2.Css 动画基础animation 3.transform-style概念 4 transform 概念 5 JavaScri ...
- CSS3 3D旋转动画代码实例
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- CSS3 3D旋转动画菜单
在线演示 本地下载
- CSS3实现3D木块旋转动画
CSS3实现3D木块旋转动画,css3特效,旋转动画,3D,立体效果,CSS3实现3D木块旋转动画是一款迷人的HTML5+CSS3实现的3D旋转动画. 代码下载:http://www.huiyi8.c ...
- 用css3制作旋转加载动画的几种方法
以WebKit为核心的浏览器,例如Safari和Chrome,对html5有着很好的支持,在移动平台中这两个浏览器对应的就是IOS和Android.最近在开发一个移动平台的web app,那么就有机会 ...
随机推荐
- Android近场通信---高级NFC(二)
读写NFC标签 读写NFC标签,要涉及到从Intent对象中获取标签,并要打开与标签的通信.要读写NFC标签数据,你必须要定义自己的协议栈.但是,要记住在直接使用NFC标签工作时,你依然能够读写NDE ...
- .NET开发实战1-军队未出,粮草先行。
马上期末考试了,会想起这个学习的自己.一直都在一个人搞java的研究,C#课也没怎么去上.所以在这里想弥补一下自己没去上课的原因,也希望老师能够理解这个还在迷茫的我. 正所谓,军队未出粮草先行,所以我 ...
- 很不错的jQuery学习资料和实例
这些都是学习Jquery很不错的资料,整理了一下,分享给大家. 希望能对大家的学习有帮助. 帕兰 Noupe带来的51个最佳jQuery教程和实例, 向大家介绍了jQuery的一些基本概念和使用的相关 ...
- [6] 智能指针boost::weak_ptr
[1]boost::weak_ptr简介 boost::weak_ptr属于boost库,定义在namespace boost中,包含头文件 #include<boost/weak_ptr.hp ...
- Css Study - Top Menu in Header 横向间隔的菜单
.shortcut ul li { display: inline; } CSS <style> ol, ul { list-style: none; } html, body, ul, ...
- wf(三)
前言: 到现在我们可以看到,WF4包含一个.xmal 文件的设计器和一个调用活动的runtime.当你创建自己的工作流的时候,你是同时也创建了一个活动, 因为活动是一个继承System.Activit ...
- 【Tarjan】+【SPFA】APIO2009 Atm
一.算法介绍 tarjan——求解有向图强连通分量.这个算法在本人的一篇blog中有介绍,这里就不赘述了.贴上介绍tarjan的的blog链接:http://www.cnblogs.com/Maki- ...
- 如何修改mysql用户名和密码
如何修改mysql用户名和密码 以修改mysql的root密码为例修改的三种方法 方法1: 用SET PASSWORD命令 mysql>SET PASSWORD FOR 'root'@'lo ...
- IE浏览器bug罪魁祸首--hasLayout
IE浏览器一直都是前端程序员最头疼的,IE的表现与其他浏览器不同的原因之一就是,显示引擎使用一个称为布局(layout)的内部概念. 认识hasLayout--haslayout是Windows In ...
- 浏览器何时发送一个Option请求
Http Options Method 简而言之,OPTIONS请求方法的主要用途有两个: 1.获取服务器支持的HTTP请求方法: 2.用来检查服务器的性能. CORS(跨域资源共享) CORS是一种 ...