首页 > 作文

CSS3 制作绽放的莲花采用效果叠加实现

更新时间:2023-04-03 15:50:12 阅读: 评论:0

这效果看起来挺炫,但原理并不复杂,能实现一片花瓣动起来,就能实现9片花瓣。效果的叠加而已。

html:

复制代码 代码如下:

<ction class=”demo”>

<div class=”box”>

<div class=”leaf”></div>

<div class=”leaf”></div>

<div class=”leaf”></div>

<div class=”leaf”></div>

<div class=”leaf”></div>

<div class=”leaf”></div>

<div class=”leaf”></div>

<div class=”leaf”></div>

<div class=”leaf”></div>

</div>

</ction>

css:

复制代码 代码如下:

view code

body {

background-color: #000;

}

.demo {

margin:0px auto;

width: 500px;

}

/*莲花花瓣的容器*/

.box {

position: relative;/*设置相对定位,因为花瓣都要进行绝对定位*/

height: 400px;

margin-top:400px东野稷败马

}

/*花瓣进行绝对定位*/

.box .leaf {

position: absolute;

}

/*绘制莲花花瓣*/

.leaf {

margin-top:0px;

width: 200px;

height: 200px;

border-radius: 200px 0px;/*制作花瓣角*/

background: -moz-linear-gradient(45deg,rgba(188,190,192,1) 8%,rgba(158,31,99,1) 30%,rgba(158,31,99,1) 100%);/*制作花瓣颜色*/

background: -webkit-linear-gradient(45deg,rgba(188,190,192,1) 8%,rgba(158,31,99,1) 30%,rgba(158,31,99,1) 100%);/*制作花瓣颜色*/

opacity: .6;

filter:alpha(opacity=50);

transform: rotate(135deg);/*花瓣旋转135deg*/

transform-origin: top right;/*重置花瓣旋转原点,这个很重要*/

}

@keyframes show-2 {

% {

transform: rotate(135deg);

}

% {

transform: rotate(45deg);

}

%{

transform: rotate(135deg);

}

}

@keyframes show-3 {

% {

transform: rotate(135deg);

}

% {

transform: rotate(65deg);

}

%{

transform: rotate(135deg);

}

}

@keyframes show-4 {

% {

transform: rotate(135deg);

}

% {

transform: rotate(85deg);

}

%{

transform: rotate(135deg);

}

}

@keyframes show-5 {

% {

transform: rotate(135deg);

}
七夕图片
% {

transform: rotate(105deg);

}

%{

transform: rotate(135deg);

}

}

@keyframes show-6 {

% {

transform: rotate(135deg);

}

% {

transform: rotate(165deg);

}

%{

transform: rotate(135deg);

}

}

@keyframes show-7 {

% {

transform: rotate(135deg);

}

% {

transform: rotate(185deg);

}

%{

transform: rotate(135deg);

}

}

@keyframes show-8 {

% {

transform: rotate(135deg);

}

% {

transform: rotate(205deg);

}

%{

trans改革开放多少年form: rotate(135deg);

}

}

@keyframes show-9 {

% {

transform: rotate(135deg);

}

% {

transform: rotate(225deg);

}

%{

transform: rotate(135deg);

}

}

.leaf:nth-child(1) {

background: -moz-linear-gradient(45deg,rgba(250,250,250,1) 8%,rgba(158,31,99,1) 30%,rgba(158,31,99,1) 100%);/*制作花瓣颜色*/

}

.leaf:nth-child(2) {

animation: show-2 6s ea-in-out infinite;

}

.leaf:nth-child(3) {甘棠湖

animation: show-3 6s ea-in-out infinite;

}

.leaf:nth-child(4) {

animation: show-4 6s ea-in-out infinite;

}

.leaf:nth-child(5) {

animation: show-5 6s ea-in-out infinite;

}

.leaf:nth-child(6) {

animation: show-6 6s ea-in-out infinite;

}

.leaf:nth-child(7) {

animation: show-7 6s ea-in-out infinite;

}

.leaf:nth-child(8) {

animation: show-8 6s ea-in-out infinite;

}

.leaf:nth-child(9) {

animation: show-9 6s ea-in-out infinite;

}

演示:

<!doctype html> <html> <head> <meta chart=”utf-8″> <title></title> <meta name=”robots” content=”noindex, nofollow”> <link rel=”canonical” href=”http://cssdeck.com/labs/ua52kzsu”> <style> * { margin: 0; padding: 0; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } html, body, iframe { width: 100%; height: 100%; } body { overflow: hidden; } iframe { border: 0 none; padding-top: 30px; } header {overflow: hidden;} header { height: 30px; max-height: 30px; width: 100%; position: absolute; background: #3c404b; border-bottom: 1px solid #000; } /* logo */ .logo { width: 60px; float: left; box-shadow: 8px 20px 18px -2px rgba(0, 0, 0, 0.22); } .logo a { text-indent: -9999px; display: block; text-decoration: none; border: none; outline: none; background: url(https://dl.dropbox.com/u/26141789/logotop.png) 50% 50% no-repeat; height: 30px; width: 60px; } /* navigation */ .top_nav, .extra { float: left; padding: 0; margin: 0; list-style: none; } .extra { float: right; margin-right: 1px; } .top_nav li, .extra li { float: left; position: relative; } .top_nav li a, .extra li a { height: 30px; display: block; text-align: center; font: 12px/30px “open sans”, arial, sans-rif; color: #efefef; text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.22); text-decoration: none; padding: 0 25px; overflow: hidden; position: relative; } .top_nav >沙子城堡 li > a, .extra > li > a, .logo a { -webkit-transition: all .3s ea; -moz-transition: all .3s ea; transition: all .3s ea; } /* header has overflow: hidden which won’t let dropdown appear. so why not u my amazing skills and write the worst hacks ever! */ .top_nav > li > a:before, .extra > li > a:before { position: absolute; width: 100%; content: ”; height: 30px; box-shadow: 8px 12px 18px -2px rgba(0, 0, 0, 0.22); top: 0; left: -100%; } header li.ur_menu > a { padding: 5px 10px 0; background: #333; } header li:hover > a, header li a:hover, .logo a:hover{ background-color: rgba(0, 0, 0, .5); } </style> <body> <header> <ul class=”extra” style=”float: right;”> <li><a href=”http://twitter.com/share?text=full view for &via=cssdeck” target=”_blank”>tweet</a></li> <li><a href=”/labs/ua52kzsu/0″>edit in labs</a></li> </ul> </header> <iframe src=”http://cure.cssdeck.com/labs/full/ua52kzsu/0/noframe#dontkillanim”></iframe> <script> window.__stop_animations = fal; </script> </body> </html>

提示:您可以先修改部分代码再运行

本文发布于:2023-04-03 15:47:37,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/zuowen/714fce68286ce394ba9bf3a28523793f.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

本文word下载地址:CSS3 制作绽放的莲花采用效果叠加实现.doc

本文 PDF 下载地址:CSS3 制作绽放的莲花采用效果叠加实现.pdf

标签:花瓣   代码   颜色   效果
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图