WWDC 2015动画效果 transform transition animation 练习

HTML和CSS实现

  1 <!DOCTYPE html>
  2 <html>
  3 <head>
  4 <meta charset="UTF-8">
  5 <title>canvas</title>
  6 <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, minimal-ui" />
  7 <style type="text/css">
  8 *{margin:0;padding:0;}
  9 html{font-size:24px;}
 10 .canvas{width:0;height:0;position:absolute;left:50%;top:50%;-webkit-transform:rotate(0deg) scale(0.3);transition:all .6s ease-in;}
 11 .canvas:before,
 12 .canvas:after{content:‘‘;width:10rem;height:10rem;position:absolute;top:50%;left:50%;margin:-5rem 0 0 -5rem;border-radius:20%;background:rgba(30, 7, 66, 0.65);z-index:10;-webkit-transform:scale(0.1);transform:scale(0.1);transition:all .6s ease-in}
 13 .canvas .content{width:10rem;height:10rem;position:absolute;margin:-5rem 0 0 -5rem;z-index:10;font-family:‘HelveticaNeue-Light‘,‘Helvetica Neue Light‘,‘Helvetica Neue‘,Helvetica,Arial,sans-serif;color:#fff;text-shadow:1px 1px 3px rgba(0,0,0,0.5);font-size:20px;text-align:center;z-index:99;opacity:0.2;-webkit-transform:rotate(180deg);transition:all .4s ease-in;}
 14 .canvas .content svg{fill:#fff;width:3em;margin:1em auto 0.75em;}
 15 .canvas .content h1{font-weight:lighter;font-size:1.4em;margin:0.2em auto 0.8em;max-width:6em;}
 16 .canvas .content p{font-size:0.8em;}
 17 .canvas .circel{-webkit-animation:rotate 12s linear .6s infinite;animation:rotate 12s linear .6s infinite;}
 18 .canvas .circel i{width:10rem;height:10rem;position:absolute;margin:-10rem 0 0 -5rem;border-top:0.1em solid rgba(255,255,255,0.4);border-radius:50%;box-shadow:0 1em 2em rgba(0,0,0,0.3);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;transition:all .6s ease-in;}
 19 .canvas .circel i:after{content:‘‘;width:3rem;height:3rem;border-radius:50%;position:absolute;top:-1.7rem;left:50%;margin-left:-1.5rem;box-shadow:0 0.2em 0.4em rgba(0,0,0,0.2);}
 20 .canvas.rotate{-webkit-transform:rotate(180deg)  scale(1.1);}
 21 .canvas.rotate:before{-webkit-transform:rotate(180deg) scale(1);transform:rotate(180deg) scale(1);-webkit-animation:rotate 6s linear .6s infinite;animation:rotate 6s linear .6s infinite;}
 22 .canvas.rotate:after{-webkit-transform:rotate(135deg) scale(1);transform:rotate(135deg) scale(1);}
 23 .canvas.rotate .content{opacity:1;}
 24 .canvas.rotate i:nth-child(1){background:rgba(16, 63, 236, 0.75);-webkit-transform:rotate(0);transform:rotate(0);}
 25 .canvas.rotate i:nth-child(1):after{background:rgba(16, 63, 236, 0.75);border-radius:20%;}
 26 .canvas.rotate i:nth-child(2){background:rgba(37, 172, 162, 0.75);-webkit-transform:rotate(45deg);transform:rotate(45deg);}
 27 .canvas.rotate i:nth-child(2):after{background:rgba(37, 172, 162, 0.75);}
 28 .canvas.rotate i:nth-child(3){background:rgba(233, 124, 32, 0.75);-webkit-transform:rotate(90deg);transform:rotate(90deg);}
 29 .canvas.rotate i:nth-child(3):after{background:rgba(233, 124, 32, 0.75);border-radius:20%;}
 30 .canvas.rotate i:nth-child(4){background:rgba(235, 67, 35, 0.75);-webkit-transform:rotate(135deg);transform:rotate(135deg);}
 31 .canvas.rotate i:nth-child(4):after{background:rgba(235, 67, 35, 0.75);}
 32 .canvas.rotate i:nth-child(5){background:rgba(190, 28, 65, 0.75);-webkit-transform:rotate(180deg);transform:rotate(180deg);}
 33 .canvas.rotate i:nth-child(5):after{background:rgba(190, 28, 65, 0.75);border-radius:20%;}
 34 .canvas.rotate i:nth-child(6){background:rgba(208, 57, 159, 0.75);-webkit-transform:rotate(225deg);transform:rotate(225deg);}
 35 .canvas.rotate i:nth-child(6):after{background:rgba(208, 57, 159, 0.75);}
 36 .canvas.rotate i:nth-child(7){background:rgba(150, 32, 198, 0.75);-webkit-transform:rotate(270deg);transform:rotate(270deg);}
 37 .canvas.rotate i:nth-child(7):after{background:rgba(150, 32, 198, 0.75);border-radius:20%;}
 38 .canvas.rotate i:nth-child(8){background:rgba(95, 33, 203, 0.75);-webkit-transform:rotate(315deg);transform:rotate(315deg);}
 39 .canvas.rotate i:nth-child(8):after{background:rgba(95, 33, 203, 0.75);}
 40
 41 @-webkit-keyframes ‘rotate‘{
 42     0%{
 43         -webkit-transform:rotate(0);
 44     }
 45     100%{
 46         -webkit-transform:rotate(360deg);
 47     }
 48 }
 49 @keyframes ‘rotate‘{
 50     0%{
 51         -webkit-transform:rotate(0);
 52                 transform:rotate(0);
 53     }
 54     100%{
 55         -webkit-transform:rotate(360deg);
 56                 transform:rotate(360deg);
 57     }
 58 }
 59 </style>
 60 <script>
 61 function hasClass(obj, cls) {
 62     return obj.className.match(new RegExp(‘(\\s|^)‘ + cls + ‘(\\s|$)‘));
 63 }
 64
 65 function addClass(obj, cls) {
 66     if (!this.hasClass(obj, cls)) obj.className += " " + cls;
 67 }
 68
 69 window.onload = function(){
 70     var canvas = document.getElementById(‘canvas‘);
 71     addClass(canvas, ‘rotate‘);
 72 }
 73 </script>
 74 </head>
 75 <body>
 76     <div id="canvas" class="canvas">
 77          <div class="content">
 78             <svg viewBox="0 0 160 164" xmlns="http://www.w3.org/2000/svg">
 79                 <g>
 80                     <g id="svg_1">
 81                     <path d="m127.805969,90.003128c0.224838,24.213104 21.241287,32.270615 21.474121,32.373459c-0.177704,0.56826 -3.358078,11.482742 -11.072464,22.756622c-6.668747,9.746841 -13.590027,19.457977 -24.493088,19.659103c-10.713348,0.197403 -14.158287,-6.353043 -26.406677,-6.353043c-12.24469,0 -16.072174,6.151901 -26.213551,6.550446c-10.52422,0.398254 -18.538303,-10.539917 -25.26247,-20.251053c-13.740021,-19.864456 -24.24024,-56.132286 -10.1411,-80.613663c7.004152,-12.157551 19.521101,-19.85622 33.10713,-20.053638c10.334515,-0.197132 20.089069,6.952717 26.406689,6.952717c6.313614,0 18.167473,-8.59832 30.628998,-7.335548c5.21682,0.217129 19.860519,2.1073 29.263641,15.871029c-0.75766,0.469692 -17.472931,10.200527 -17.291229,30.443592m-20.134499,-59.456692c5.587379,-6.7633 9.348007,-16.178439 8.322067,-25.546439c-8.053787,0.32369 -17.792625,5.36682 -23.569427,12.126399c-5.177124,5.985922 -9.711121,15.566772 -8.48777,24.749359c8.976891,0.69453 18.147476,-4.561718 23.73513,-11.329308"/>
 82                     </g>
 83                 </g>
 84             </svg>
 85             <h1>The epicenter of change.</h1>
 86             <p>WWDC15</p>
 87         </div>
 88         <div id="circelWrap" class="circel">
 89             <i></i>
 90             <i></i>
 91             <i></i>
 92             <i></i>
 93             <i></i>
 94             <i></i>
 95             <i></i>
 96             <i></i>
 97         </div>
 98     </div>
 99 </body>
100 </html>
时间: 2024-10-27 12:48:36

WWDC 2015动画效果 transform transition animation 练习的相关文章

css——动画(transform, transition, animation)

transform 静态属性,一旦写进style里面,会立即显示作用,无任何变化过程.(类似于left, right, top, bottom这类属性) 主要用来做元素的变形 改变元素样式的属性主要有以下五个 translate3d(x,y,z) 用来控制元素在页面的三轴上的位置 rotate(10deg) 是用来控制元素旋转角度(度deg) skewx,y 制作斜度,2d里面创建3d透视图的必备属性 scale3d(2, 1.5, -6) 用来放大缩小效果,属性是比值 matrix3d css

css3 transform transition animation 练习

旋转 位移 缩放 扭曲 动画 <!DOCTYPE HTML><html> <head> <meta charset="utf-8" /> <title>css3 transform transition animation 练习</title> <style type="text/css"> body { padding: 10px 50px; } div { margin: 50p

Android动画效果之Frame Animation(逐帧动画)(二)(

前言: 上一篇介绍了Android的Tween Animation(补间动画) Android动画效果之Tween Animation(补间动画),今天来总结下Android的另外一种动画Frame Animation(逐帧动画). Frame Animation(逐帧动画): 逐帧动画(Frame-by-frame Animations)从字面上理解就是一帧挨着一帧的播放图片,就像放电影一样.和补间动画一样可以通过xml实现也可以通过java代码实现.接下来借助目前项目中的一个开奖的动画来总结

Android动画效果之Frame Animation(逐帧动画)

前言: 上一篇介绍了Android的Tween Animation(补间动画) Android动画效果之Tween Animation(补间动画),今天来总结下Android的另外一种动画Frame Animation(逐帧动画). 其他几种动画效果: Android动画效果之Tween Animation(补间动画) Android动画效果之Frame Animation(逐帧动画) Android动画效果之初识Property Animation(属性动画) Android动画效果之Prop

CSS3动画效果之transition

CSS3中有两种方式实现动画,transition和[email protected]. 两者的作用机制不一样:transition定义在可能要进行动画的元素上,对某些CSS属性进行监听,一旦CSS改变则进行动画:animation定义在马上要进行动画的元素上,一旦定义动画即进行. 比如当鼠标悬浮的时候,某元素由红色改为绿色.使用transition和animation实现的共同代码如下: <!DOCTYPE html> <html lang="en"> <

Android动画效果之Tween Animation(补间动画)(一)

前言: 最近公司项目下个版本迭代里面设计了很多动画效果,在以往的项目中开发中也会经常用到动画,所以在公司下个版本迭代开始之前,抽空总结一下Android动画.今天主要总结Tween Animation(补间动画). Tween Animation(补间动画): Tween动画,通过对View的内容进行一系列的图形变换 (包括平移.缩放.旋转.改变透明度)来实现动画效果.动画效果的定义可以采用XML来做也可以采用编码来做. 动画类型 XML配置方式 Java代码实现方式 渐变透明度动画效果 <al

css 动画 transform transition animation

1.transform  transform 是通过在浏览器里面让网页元素 移动 旋转 透明 模糊 等方法来实现改变其外观的技术 -webkit-transform : translate(3em,0);想右移动3em,向下移动0em -webkit-transform : rotate(30deg);顺时针旋转30度 -webkit-transform : translate(-3em,1em);向左移动3em,向下移动1em -webkit-transform : scale(2);尺寸放大

CSS3 --一句话概括Transform,Transition,Animation区别

Transform:对元素进行变形:Transition:对元素某个属性或多个属性的变化,进行控制(时间等),类似flash的补间动画.但只有两个关键贞.开始,结束.Animation:对元素某个属性或多个属性的变化,进行控制(时间等),类似flash的补间动画.可以设置多个关键贞. 精心开发5年的UI前端框架! Transition与Animation:transition需要触发一个事件 ,而animation在不需要触发任何事件的情况下也可以显式的随着时间变化来改变元 素css的属性值,从

CSS3动画效果transform

1.transform浏览器支持情况 也就是说目前不考虑老浏览器的话是不用加前缀的,感谢菜鸟教程:https://www.runoob.com/cssref/css3-pr-transform.html transform默认值none;就是不转换,不继承,js中对其更改示例:object.style.transform="rotate(7deg)" 2.transform能干啥? transform属性让元素进行2D或3D转换.可以将元素:旋转,缩放,移动,倾斜等. 3.transf