scss+div实现逼真立体月球月亮旋转动画效果代码
代码语言:html
所属分类:动画
代码描述:scss+div实现逼真立体月球月亮旋转动画效果代码
代码标签: scss div 逼真 立体 月球 月亮 旋转 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style type = 'text/scss'> $blk: #1a0606; $none: rgba(#fff, 0); $white: #fff; $crater: #2e292a; $lte: #bfbebb; // fix the ugly crater placement html, body, div { height: 100%; } html { font-size: 1vmin; background: $blk; } body { margin: auto; } div { transform-style: preserve-3d; perspective: 100em; position: relative; *, *:before, *:after, &:after { content: ""; position: absolute; left: 0; top: 0; box-sizing: border-box; transform-style: preserve-3d; backface-visibility: hidden; } &:after { width: 50em; height: 50em; background: radial-gradient(circle at top, $none, $blk); transform: translate3d(0, 0, 40em); margin: auto; bottom: 0; right: 0; } } moon { margin: auto; inset: 0; width: 81em; height: 81em; background: lighten($crater, 10); border-radius: 50%; spin { animation: r 10s linear infinite; width: 80em; height: 0; margin: auto; inset: 0; } c { width: 80em; height: 1em; &:before, &:after { width: 5em; height: 5em; box-shadow: 0 -1em $blk, inset 0 -1em $lte; border-radius: 50%; transform: rotateY(-90deg); } &:after { transform: translate3d(75rem, 0, 0) rotateY(90deg); } } @for $i from 1 through 60 { c:nth-of-type(#{$i}) { transform: rotate(random(360) * 1deg) rotateY(random(360) * 1deg); &:before { transform: rotateY(-90deg) scale(random(10) / 10); } &:after { transform: translate3d(75rem, 0, 0) rotateY(90deg) scale(random(10) / 10); } } } @keyframes r { to { transform: rotateY(360deg); } } } .sig { &, * { height: 9.25em; overflow: hidden; border-radius: 0.5em; } position: absolute; left: auto; right: 1rem; top: 1rem; font-size: 0.5rem; color: $white; width: 10em; transform: skewX(10deg) scaleY(0.45) rotate(2deg); mix-blend-mode: difference; &:before, *:before { content: ""; position: absolute; top: 0; left: 0; width: 5em; height: 5em; background: currentColor; transform: translate3d(-2.5em, 0, 0) rotate(-45deg); box-shadow: -3em 3em 0 0 currentColor; border-radius: 0.5em 2em 0.5em 2em; } * { width: 5em; transform: translate3d(3.75em, 0, 0) scaleY(0.95); display: block !important; &:before { tra.........完整代码请登录后点击上方下载按钮下载查看
网友评论0