Skip to main content
1-Visitor
March 30, 2020
Solved

blinking of a 3d image

  • March 30, 2020
  • 1 reply
  • 1268 views

How to create a 3d image that is blinking?

Best answer by ClayHelberg

You would probably need to use an $interval timer for this, along these lines:

$scope.blinkInterval = 0;

$scope.blinkImage = function(id) {
 var current = $scope.view.wdg[id].visible;
 if (current == undefined) { current = true;}
 $scope.setWidgetProp(id, "visible", !current);
}

$scope.startBlink = function() {
 $scope.blinkInterval = $interval($scope.blinkImage, 1000, 0, true, "3DImage-1");
}

$scope.stopBlink = function(id) {
 $interval.cancel($scope.blinkInterval);
}

angular.element(document).ready($scope.startBlink);

You can use the $scope.stopBlink() function to stop the image from blinking, either in response to an event or attached to a UI control if you want.

If you want to control when the blinking starts, simply remove the last line and add a call to $scope.startBlink() when you want it to start blinking.

1 reply

18-Opal
March 30, 2020

You would probably need to use an $interval timer for this, along these lines:

$scope.blinkInterval = 0;

$scope.blinkImage = function(id) {
 var current = $scope.view.wdg[id].visible;
 if (current == undefined) { current = true;}
 $scope.setWidgetProp(id, "visible", !current);
}

$scope.startBlink = function() {
 $scope.blinkInterval = $interval($scope.blinkImage, 1000, 0, true, "3DImage-1");
}

$scope.stopBlink = function(id) {
 $interval.cancel($scope.blinkInterval);
}

angular.element(document).ready($scope.startBlink);

You can use the $scope.stopBlink() function to stop the image from blinking, either in response to an event or attached to a UI control if you want.

If you want to control when the blinking starts, simply remove the last line and add a call to $scope.startBlink() when you want it to start blinking.