html5 - 花瓣散落效果怎么写 怎么生成好多花瓣
问题描述
.swiper-wrapper .swiper-slide:nth-of-type(1) { background: url('../img/p1_bg.jpg'); background-size: 100% 100%;}.swiper-wrapper .swiper-slide:nth-of-type(1) img:nth-child(1){ position: absolute; top: 35%; left: 4%; animation: rotate_flower1 4s linear infinite;}.swiper-wrapper .swiper-slide:nth-of-type(1) img:nth-child(2){ position: absolute; top: 23%; left: 45%; animation: rotate_flower2 4s linear infinite;}.swiper-wrapper .swiper-slide:nth-of-type(1) img:nth-child(3){ position: absolute; top: 32%; left: 33%; animation: rotate_flower2 4s linear infinite; }.swiper-wrapper .swiper-slide:nth-of-type(1) img:nth-child(4){ position: absolute; top: 46%; left: 43%; animation: rotate_flower3 4s linear infinite;}.swiper-wrapper .swiper-slide:nth-of-type(1) img:nth-child(5){ position: absolute; top: 38%; left: 77%; animation: rotate_flower2 4s linear infinite;}.swiper-wrapper .swiper-slide:nth-of-type(1) img:nth-child(6){ position: absolute; top: 31%; left: 48%; animation: rotate_flower1 4s linear infinite;}.swiper-wrapper .swiper-slide:nth-of-type(1) img:nth-child(7){ position: absolute; top: 26%; left: 28%; animation: rotate_flower3 4s linear infinite;}.swiper-wrapper .swiper-slide:nth-of-type(1) img:nth-child(8){ position: absolute; top: 35%; left: 67%; animation: rotate_flower3 4s linear infinite;}.swiper-wrapper .swiper-slide:nth-of-type(1) img:nth-child(9){ position: absolute; top: 25%; left: 89%; animation: rotate_flower2 4s cubic-bezier(.2,0,.1,0) infinite; }.swiper-wrapper .swiper-slide:nth-of-type(1) img:nth-child(10){ position: absolute; top: 33%; left: 75%; animation: rotate_flower1 4s linear infinite;}@keyframes rotate_flower1{ to{ transform: rotate(359deg); top: 78%; } }@keyframes rotate_flower2{ to{transform: rotate(359deg);top: 92%; }}@keyframes rotate_flower3{ to{transform: rotate(359deg);top: 86%;opacity: 0; }}
我现在是一个一个写的 很挫啊而且不能有很多花瓣 很多花瓣是怎么在只有几个的情况下无限生成 不用canvas能实现么或者 用canvas怎么实现呢
问题解答
回答1:找几张花瓣的图片,js控制旋转不同的角度不就好了
回答2:layabox,phaser,粒子效果
回答3:多张花瓣的图片,用js随机生成花瓣的位置和花瓣的旋转和选择花瓣的图片。
相关文章:
1. 请问一下用notepad++可以照着你这样来编吗?为什么我用notepad++编辑的时候那个容器那里颜色是黑的,不会像其他变量那样变颜色。2. javascript - 三目运算符的一些问题3. python中生产者消费者线程问题4. mysql - 我的myeclipse一直连显示数据库连接失败,不知道为什么5. css3 - 这个效果用 CSS 可以实现吗?border-image6. android - 京东移动端网页和其app加载的url所做的呈现不应该是完全一样的吗?7. 请教,关于python字典,合并相同值的键的实现方法8. 输入地址报以下截图错误,怎么办?9. python - 在sqlalchemy中获取刚插入的数据id?10. 站点内容复制额外增加的版权申明,真的很反人类。试问产品自己在用这个站点吗?

网公网安备