css3风吹树叶,纯CSS3实现的树叶形状和飘落动画

这篇博客展示了如何使用CSS3创建逼真的风吹树叶动画。通过定义不同形状的树叶,结合旋转、平移和透明度变化的动画效果,营造出树叶从上飘落的真实感。博客内容包括树叶的各个部分(如花瓣和茎)的样式定义,以及针对不同树叶的动画关键帧设置。
摘要由CSDN通过智能技术生成

CSS

语言:

CSSSCSS

确定

* {

box-sizing: border-box;

}

body {

background: #1d1f20;

padding-top: 40px;

}

.leaves {

height: 300px;

width: 42em;

margin: 0 auto;

}

.leaf {

position: relative;

width: 8em;

display: inline-block;

bottom: 400px;

}

.leaf .petal {

width: 4.5em;

height: 4.5em;

-webkit-border-radius: 80% 0 55% 50% / 55% 0 80% 50%;

border-radius: 80% 0 55% 50% / 55% 0 80% 50%;

-webkit-transform: rotateZ(-45deg);

transform: rotateZ(-45deg);

margin: 0 auto;

position: absolute;

}

.petal:nth-child(1) {

position: static;

}

.petal:nth-child(2) {

top: 30px;

transform: rotateZ(-80deg);

}

.petal:nth-child(3) {

top: 30px;

transform: rotateZ(-10deg);

right: 0;

}

.petal:nth-child(4) {

top: 70px;

transform: rotateZ(-102deg);

left: -5px;

}

.petal:nth-child(5) {

top: 70px;

transform: rotateZ(12deg);

right: -5px;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值