变量和参数名称

时间:2018-02-14 23:31:03

标签: c++

#truck_cones { width: 128px; }
.cone { fill: transparent; }
#base { fill: gray; }
#truck { fill: blue; transform-origin: 64px 64px; }

$duration: 2.5s;
$cone_dudation: ($duration * 2);
$steps: 12;
$step_increment: ($cone_dudation / $steps) / 2;

@keyframes truck_rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#truck {
    animation: $duration linear infinite truck_rotate;
}

@keyframes cone_on {
    0% { fill: orange; }
    49.99% { fill: orange; }
    50% { fill: transparent; }
    100% { fill: transparent; }
}
@keyframes cone_off {
    0% { fill: transparent; }
    49.99% { fill: transparent; }
    50% { fill: orange; }
    100% { fill: orange; }
}

$cone: 30;
$delay_on: 0s;
$delay_off: $duration;
@for $i from 1 through $steps {
    #cone_#{$cone} {
        animation: $cone_dudation $delay_on linear infinite cone_on, $cone_dudation $delay_off linear infinite cone_off;
    }
    $cone: $cone + 30;
    $delay_on: $delay_on + $step_increment;
    $delay_off: $delay_off + $step_increment;
}

此代码是否设置"模式1"等于输入参数调用模式?如果有人能够解释这里发生的事情以及其他有趣的警告和解决方法,那就太棒了!我很好奇这段代码是如何工作的。

1 个答案:

答案 0 :(得分:3)

定义为输入参数的局部变量mode将始终优先于全局变量,因此您编写的语句将不会执行任何操作。 [编辑]假设您正在使用c ++,您可以使用范围解析运算符来引用全局变量

::mode = mode;  //mode 1 = input parameter mode
相关问题