$scope.mTouch=function(c){
$scope.showMiddle=true;
$scope.hint=c;
$scope.testc=c;
var timer1=null;
var timer2=null;
var alpha=0;
var speed=5;
var oDiv=document.getElementById("div1");
clearInterval(timer1);
clearInterval(timer2);
oDiv.style.opacity=0;
timer1=setInterval(function(){
if(alpha<100){
console.log('ccc');
alpha+=speed;
oDiv.style.filter="alpha(opacity:"+alpha+")";
oDiv.style.opacity=alpha/100;
}else if(alpha===100){
console.log('aaa');
clearInterval(timer1);
$timeout(function(){
timer2=setInterval(function(){
if(alpha>0){
speed=5;
console.log('ddd');
alpha-=speed;
oDiv.style.filter="alpha(opacity:"+alpha+")";
oDiv.style.opacity=alpha/100;
}else if(alpha<=0){
console.log('bbb');
$scope.showMiddle=false;
clearInterval(timer2);
}
},30);
},100);
}
},30);
}
<div style="
position: fixed;
left: 35%;
top: 32%;
width: 95px;
height: 70px;
background: rgb(221, 221, 221);
display: flex;
justify-content: center;
align-items: center;
font-size: 40px;
font-weight: 700;
color: rgb(136, 136, 136);
opacity: 0;
border-radius: 10px;
" id="div1" ng-show="showMiddle">
{{hint}}
</div>