css+scene实现树木生长新芽开花落下动画效果代码

代码语言:html

所属分类:动画

代码描述:css+scene实现树木生长新芽开花落下动画效果代码

代码标签: css scene 树木 生长 新芽 开花 落下 动画

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">

  
  
  
<style>
body {
	background : #FEFDE3;
}        
.slope {
	background: #CADC88;
	width: 100%;
	height: 100px;
	border-radius: 50% 50% 0px 0px / 100% 100% 0px 0px;
	overflow: hidden;
    z-index: -1;
}
.slope:before {
    content: "";
    background: #F2EDB4;
    border-radius: 50%;
    width:80px;
    height: 30px;
    position: absolute;
    left:50%;
    margin-left: -40px;
    top:-5px;   
    
    
}
.background {
    width: 350px;
    height: 445px;
    position: absolute;
    margin: auto;
    bottom: 0;
    left: -200px;
    right: -200px;
    
}
.background .slope {
    position: absolute;
    bottom:0;
}
.background>.flower {
    width: 25px;
    height: 25px;
    z-index: 0;
}
.background>.flower1 {
    top: 30px;
    left: 20%;
}
.background>.flower2 {
    top: 50px;
    left: 40%;
}
.background>.flower3 {
    top: 20px;
    left: 60%;
}
.background>.flower4 {
    top: 80px;
    left: 80%;
}
.background>.flower5 {
    top: 80px;
    left: 50%;
}
.tree {
/* 			background: ; */
    width:2px;
/* 			height: 200px; */
    border-right: 8px solid transparent;
    border-left: 8px solid transparent;
    border-bottom: 300px solid #816954;
    position: absolute;
    left: 50%;
    
    transform-origin: 50% 300px;
    top: 50px;
    margin-left: -8px;
}


.branch {
    position: absolute;
    width: 150px;
    height: 40px;
    border-bottom: 5px solid #816954;			
}
.branch:before, .branch:after {
    content: "";
    position: absolute;
    width: inherit;
    height: inherit;
    border:inherit;
    border-radius: inherit;
    z-index: 0;
}
.branch:before {
    transform: rotate(1deg);
}
.branch:after {
    transform: rotate(2deg);
}
.branch.left, .branch.left:before, .branch.left:after {
    transform-origin: 0px 0px;
}
.branch.right, .branch.right:before, .branch.right:after {
    transform-origin: 100% 0px;
}
.branch.left {
    border-bottom-left-radius: 100% 100%;
    transform-origin: 100% 100%;
}
.branch.right {
    border-bottom-right-radius: 100% 100%;
    transform-origin: 0% 100%;
    margin-left: 1px;
}

.tree>.branch.left {
    transform:rotate(5deg);
}
.tree>.branch.right {
    transform:rotate(-5deg);
}
.leaf { 
    position: absolute;
    width: 23px;
    height: 23px;
    background: #C5EABE; 
    border-radius: 0px 100%;
    z-index: 1;
    transform-origin: 0px 0px;
    
}
.leaf:before {
/*    content:"";*/
    position: absolute;
    width:2px;
    height: 2px;
    background: #f55;
}
.flower {
    position: absolute;
    width: 50px;
    height: 50px;
    z-index: 2;
}
.flower:after {
    position: absolute;
    content: "";
    left: 0px;
    right: 0px;
    top: 0px;
    bottom: 0px;
    background: #e55;
    border-radius: 50%;
    width: 30%;
    height: 30%;
    margin: auto;
}
.flower .petal {
    width: 100%;
    height: 100%;
    position: absolute;
    transform: rotate(72deg);
}
.flower .petal::before, .flower .petal::after {
    content: "";
    position: absolute;
    width: 60%;
    height: 60%;
    background: #F0A5A6;
    border-radius: 0px 100px;
    top: 50%;
    left: 50%;
    margin-left: -20%;
    margin-top: -20%;
    transform-origin: 33% 33%;
}
.flower .petal::after {
    transform: rotate(36deg)
}

.flower.petal5 .petal {
    transform: rotate(144deg);
}
.flower.petal5 .petal::after {
    transform: rotate(-72deg);   
}
.flower.petal5>.petal::after {
    content:none;
}
.flower.petal6 .petal{
    transform: rotate(120deg);
}
.flower.petal6 .petal::after {
    transform: rotate(60deg);   
}
.flower.petal8 .petal{
    transform: rotate(90deg);
}
.flower.petal8 .petal::after {
    transform: rotate(45deg);   
    width: 56%;
    height: 56%;
}


.flower.roundpetal .petal:before, .flower.roundpetal .petal:after{
    width: 30%;
    border-radius: 0px;
    margin-left: -15%;
    margin-top: 0%;
    top: 0%;
    height: 50%;
    border-radius: 50% 50% 0px 0px;
    transform-origin: 50% 100%;
}
.heart {
    position:absolute;
    width: 50px;
    height: 50px;
    z-index: 2;
}
.heart:before, .heart:after {
    position: absolute;
    content: "";
    width:80%;
    height: 80%;
    border-radius: 100.........完整代码请登录后点击上方下载按钮下载查看

网友评论0