马黑PHP整站系统

叶瓣效果

位置: 首页 > 代码集锦[ 发布时间: 2024.2.15  作者: 马黑  阅读: 128 ]

一、代码

<style>
#wrap {
	margin: 20px auto;
	position: relative;
	width: 200px;
	height: 200px;
	animation: rot 6s linear infinite;
}
ye-zi {
	position: absolute;
	left: calc(50% - 0.5 * var(--ww));
	top: 0;
	width: var(--ww);
	height: 100px;
	border-radius: 0% 100%;
	background: linear-gradient(red, orange, green);
	transform-origin: 50% 100%;
	transform: rotate(var(--deg));
}
@keyframes rot { to { transform: rotate(360deg); } }
</style>

<div id="wrap"></div>

<script>
let all = 5;
Array.from({length: all}).forEach((item,key) => {
	item = document.createElement('ye-zi');
	item.style.cssText += `--ww: 30px; --deg: ${360 / all * key}deg;`;
	wrap.appendChild(item);
});
</script>

二、效果

前一篇: 用CSS+HTML画一棵儿童画的树
下一篇: Promise处理音频自动播放实例

发表评论:

       

评论列表 [1条]

#1 | 知名不具 于 2024-2-16 21:21 发布: 对称的美,橘色尤其带点环的效果呢。

Copyright © 2023 All Right Reserved 马黑PHP文章管理整站系统v1.8
联系我们: gxblk@163.com