div+css实现三维立体彩色冰淇淋旋转动画效果代码
代码语言:html
所属分类:动画
代码描述:div+css实现三维立体彩色冰淇淋旋转动画效果代码
代码标签: div css 三维 立体 彩色 冰淇淋 旋转 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
*, *::before, *::after {
padding: 0;
margin: 0 auto;
box-sizing: border-box;
}
body {
background-color: #000;
color: #fff;
min-height: 100vh;
display: grid;
place-items: center;
perspective: 1000px;
overflow: hidden;
}
body * {
transform-style: preserve-3d;
}
.scene {
position: relative;
-webkit-animation: sceneY 8s infinite ease-in-out alternate, rotate 50s infinite linear;
animation: sceneY 8s infinite ease-in-out alternate, rotate 50s infinite linear;
}
@-webkit-keyframes sceneY {
from {
transform: rotateY(60deg);
}
to {
transform: rotateY(-60deg);
}
}
@keyframes sceneY {
from {
transform: rotateY(60deg);
}
to {
transform: rotateY(-60deg);
}
}
@-webkit-keyframes rotate {
to {
rotate: 1turn;
}
}
@keyframes rotate {
to {
rotate: 1turn;
}
}
.shape {
position: absolute;
-webkit-animation: rotate 15s infinite linear;
animation: rotate 15s infinite linear;
}
.shape i {
position: absolute;
inset: -128px;
border-radius: 50%;
background-image: radial-gradient(closest-side, #0003, #0000), radial-gradient(circle at 192px 128px, #ef8f8f 32px, transparent 0), radial-gradient(circle at 173.2548339959px 173.2548339959px, #efd78f 32px, transparent 0), radial-gradient(circle at 128px 192px, #bfef8f 32px, transparent 0), radial-gradient(circle at 82.7451660041px 173.2548339959px, #8fefa7 32px, transparent 0), radial-gradient(circle at 64px 128px, #8fefef 32px, transparent 0), radial-gradient(circle at 82.7451660041px 82.7451660041px, #8fa7ef 32px, transparent 0), radial-gradient(circle at 128px 64px, #bf8fef 32px, transparent 0), radial-gradient(circle at 173.2548339959px 82.7451660041px, #ef8fd7 32px, transparent 0);
transform: translateZ(var(--tz)) rotate(var(--angle)) scale(var(--scale));
}
.shape i:nth-child(1) {
--tz: -144px;
--angle: 0deg;
--scale: 0.01;
}
.shape i:nth-child(2) {
--tz: -142.5px;
--angle: 0.5deg;
--scale: 0.0263617316;
}
.shape i:nth-child(3) {
--tz: -141px;
--angle: 1deg;
--scale: 0.0427190828;
}
.shape i:nth-child(4) {
--tz: -139.5px;
--angle: 1.5deg;
--scale: 0.0590676743;
}
.shape i:nth-child(5) {
--tz: -138px;
--angle: 2deg;
--scale: 0.0754031292;
}
.shape i:nth-child(6) {
--tz: -136.5px;
--angle: 2.5deg;
--scale: 0.0917210741;
}
.shape i:nth-child(7) {
--tz: -135px;
--angle: 3deg;
--scale: 0.1080171403;
}
.shape i:nth-child(8) {
--tz: -133.5px;
--angle: 3.5deg;
--scale: 0.124286965;
}
.shape i:nth-child(9) {
--tz: -132px;
--angle: 4deg;
--scale: 0.1405261922;
}
.shape i:nth-child(10) {
--tz: -130.5px;
--angle: 4.5deg;
--scale: 0.1567304745;
}
.shape i:nth-child(11) {
--tz: -129px;
--angle: 5deg;
--scale: 0.1728954734;
}
.shape i:nth-child(12) {
--tz: -127.5px;
--angle: 5.5deg;
--scale: 0.1890168613;
}
.shape i:nth-child(13) {
--tz: -126px;
--angle: 6deg;
--scale: 0.205090322;
}
.shape i:nth-child(14) {
--tz: -124.5px;
--angle: 6.5deg;
--scale: 0.2211115524;
}
.shape i:nth-child(15) {
--tz: -123px;
--angle: 7deg;
--scale: 0.237076263;
}
.shape i:nth-child(16) {
--tz: -121.5px;
--angle: 7.5deg;
--scale: 0.2529801799;
}
.shape i:nth-child(17) {
--tz: -120px;
--angle: 8deg;
--scale: 0.2688190451;
}
.shape i:nth-child(18) {
--tz: -118.5px;
--angle: 8.5deg;
--scale: 0.2845886182;
}
.shape i:nth-child(19) {
--tz: -117px;
--angle: 9deg;
--scale: 0.3002846773;
}
.shape i:nth-child(20) {
--tz: -115.5px;
--angle: 9.5deg;
--scale: 0.3159030201;
}
.shape i:nth-child(21) {
--tz: -114px;
--angle: 10deg;
--scale: 0.3314394653;
}
.shape i:nth-child(22) {
--tz: -112.5px;
--angle: 10.5deg;
--scale: 0.3468898534;
}
.shape i:nth-child(23) {
--tz: -111px;
--angle: 11deg;
--scale: 0.36.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0