css キーフレームを使用して回転する円を作成しようとしていますが、これを Sass で機能させるのに苦労しています。
これが私のhtmlです:
<div class="content">
<h1 class="h1">Playing around with keyframes</h1>
<div class="circle"></div>
</div>
そして、ここにサスがあります:
.content{
display:block;
position: relative;
box-sizing:border-box;
.circle{
width: 220px;
height: 220px;
border-radius: 50%;
padding: 10px;
border-top: 2px solid $pink;
border-right: 2px solid $pink;
border-bottom: 2px solid $pink;
border-left: 2px solid #fff;
-webkit-animation:spin 4s linear infinite;
-moz-animation:spin 4s linear infinite;
animation:spin 4s linear infinite;
}
@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
@keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } }
}
Prepros を使用して Sass をコンパイルすると、出力は次のようになります (キーフレーム内のクラスに注意してください)。
@-moz-keyframes spin {
.lesson-page .content 100% {
-moz-transform: rotate(360deg);
}
}
@-webkit-keyframes spin {
.lesson-page .content 100% {
-webkit-transform: rotate(360deg);
}
}
@keyframes spin {
.lesson-page .content 100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}