1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
$color:red ,yellow ,blue ,green ,gray ,black ,purple ,orange; @-webkit-keyframes move { 0% { transform: rotateY(0deg); } 100% { transform: rotateY(360deg); } } body { padding: 200px; @at-root .content { width: 500px; height: 500px; margin: -350px auto; border: 1px solid transparent; position: relative; -webkit-perspective: 500px; -webkit-perspective-origin: center 100px; @for $i from 1 to 10 { &:nth-of-type(#{$i}) { z-index: 10 - $i } } .main { width: 100px; height: 100px; margin: 200px auto; position: relative; transform-style: preserve-3d; animation: move 8s linear infinite; div { width: 100px; height: 100px; position: absolute; bottom: 0; font-size: 100px; color: white; text-align: center; line-height: 100px; transform-style: preserve-3d; @for $i from 1 to 9 { &:nth-of-type(#{$i}) { background: nth($color, $i); transform: rotateY(45deg * $i) translateZ(150px); } } } } } }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>Examples</title> <meta name="description" content=""> <meta name="keywords" content=""> <link href="stylesheets/test.css" rel="stylesheet"> </head> <body> <div class="content"> <div class="main"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> <div>6</div> <div>7</div> <div>8</div> </div> </div> <div class="content"> <div class="main"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> <div>6</div> <div>7</div> <div>8</div> </div> </div> <div class="content"> <div class="main"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> <div>6</div> <div>7</div> <div>8</div> </div> </div> </body> </html>
时间: 2024-11-14 15:12:09