SOURCE

console 命令行工具 X clear

                    
>
console
<div></div>
@function fact($number) {
    $value: 1;
    @if $number>0 {
        @for $i from 1 through $number {
            $value: $value * $i;
        }
    }
    @return $value;
}

@function pow($number, $exp) {
    $value: 1;
    @if $exp>0 {
        @for $i from 1 through $exp {
            $value: $value * $number;
        }
    }
    @else if $exp < 0 {
        @for $i from 1 through -$exp {
            $value: $value / $number;
        }
    }
    @return $value;
}

@function rad($angle) {
    $unit: unit($angle);
    $unitless: $angle / ($angle * 0 + 1);
    @if $unit==deg {
        $unitless: $unitless / 180 * pi();
    }
    @return $unitless;
}

@function pi() {
    @return 3.14159265359;
}

@function sin($angle) {
    $sin: 0;
    $angle: rad($angle);
    // Iterate a bunch of times.
    @for $i from 0 through 15 {
        $sin: $sin + pow(-1, $i) * pow($angle, (2 * $i + 1)) / fact(2 * $i + 1);
    }
    @return $sin;
}

@function cos($angle) {
    $cos: 0;
    $angle: rad($angle);
    // Iterate a bunch of times.
    @for $i from 0 through 15 {
        $cos: $cos + pow(-1, $i) * pow($angle, 2 * $i) / fact(2 * $i);
    }
    @return $cos;
}

@function tan($angle) {
    @return sin($angle) / cos($angle);
}

@function rot1($r1)
{
    $count:8;
    @for $i from 0 through $count { 
        
        /* $pos: $pos ,{1};*/
    }
    @return $pos;
}
div
{
    width:20px;
    height:20px;

    border-radius: 100%;
    
    position:absolute;

    animation:pos 3s;
    animation-timing-function:linear;
    animation-iteration-count:infinite;

    background: #faafaa;
}
@keyframes pos
{
 00.0%    {left:cos(0.0/8*pi()*2.0)*10%+50%;top:sin(0.0/8*pi()*2.0)*10%+50%}
 12.5%    {left:cos(1.0/8*pi()*2.0)*10%+50%;top:sin(1.0/8*pi()*2.0)*10%+50%}
 25.0%    {left:cos(2.0/8*pi()*2.0)*10%+50%;top:sin(2.0/8*pi()*2.0)*10%+50%}
 37.5%    {left:cos(3.0/8*pi()*2.0)*10%+50%;top:sin(3.0/8*pi()*2.0)*10%+50%}
 50.0%    {left:cos(4.0/8*pi()*2.0)*10%+50%;top:sin(4.0/8*pi()*2.0)*10%+50%}
 62.5%    {left:cos(5.0/8*pi()*2.0)*10%+50%;top:sin(5.0/8*pi()*2.0)*10%+50%}
 75.0%    {left:cos(6.0/8*pi()*2.0)*10%+50%;top:sin(6.0/8*pi()*2.0)*10%+50%}
 87.5%    {left:cos(7.0/8*pi()*2.0)*10%+50%;top:sin(7.0/8*pi()*2.0)*10%+50%}
100.0%    {left:cos(8.0/8*pi()*2.0)*10%+50%;top:sin(8.0/8*pi()*2.0)*10%+50%}
}