2
我想制作一个从0开始的进度条,并在一定时间内增加到最大值。当它达到最大值时,它会递减并重复该过程。这是我的尝试。AngularJS:如何制作波动的进度条?
HTML:
<progressbar class="progress-striped active"
max="max"
value="value"
type="success">
</progressbar>
JS:
app.controller('progressBar', function($scope,$timeout){
$scope.max = 100;
$scope.min = 0;
$scope.value = 0;
var increment = 5;
var target = $scope.max;
$scope.increment = function() {
$scope.value += increment;
};
$scope.decrement = function() {
$scope.value -= increment;
};
$timeout(function() {
while ($scope.value <= target) {
$scope.increment();
if($scope.value === target) {
target = $scope.min;
};
};
while ($scope.value >= target) {
$scope.decrement();
if($scope.value === target) {
target = $scope.max;
};
};
}, 1000);
});
也许你应该描述你在尝试时遇到的问题。 –
我们不打算从头创建一个应用程序来测试您的问题。描述你的情况和问题 – dpaul1994