Placeing animations on modelItems with javascript
Hello,
Since I have issues with the sequences in the HoloLens, I try to get a work around.
I have a Button, that invokes the function playStep(). The function starts with "modelItem-1". Then, the function moveAway() is invoked, which moves the modelItem and then makes it invisible. When the button is pressed again, it should automatically change to "modelItem-2" and start the same animation starting at its starting position, moving it up and making it invisible. Somehow I can’t get the script using a variable for the name “modelItem-1”. Can anyone help?
var modelItemCounter=1;
var timerId = -1;
var timingInterval = 30;
var angleIncrement = 45;
var ydelta = 0;
var speed = 0.01;
var modelItemVar;
$scope.app.playStep = function() {
$scope.modelItemVar= "modelItem-"+modelItemCounter;
console.log ("modelItem: "+ modelItemVar);
var zpos = $scope.view.wdg[modelItemVar]['z'];
$scope.moveAway();
}
$scope.moveAway = function()
{
if (timerId > -1)
{
clearInterval(timerId);
}
timerId = setInterval(function()
{
var stopPosition = $scope.view.wdg[modelItemVar]['z']+0.4;
var zpos = $scope.view.wdg[modelItemVar]['z'];
$scope.app.params.zpos= $scope.view.wdg[modelItemVar]['z'];
$scope.$apply(function()
{
$scope.view.wdg[modelItemVar]['z']= $scope.view.wdg[modelItemVar]['z'] + speed;
console.log($scope.view.wdg[modelItemVar]['z']);
// $scope.app.params.zpos = $scope.app.params.zpos + speed;
}
);
}
, timingInterval);
setTimeout(function()
{
$scope.view.wdg[modelItemVar]['visible']=false;
clearInterval(timerId);
modelItemCounter++;
}
, 2000);
}

