Changing the value of the .shake animation to false removes the class. Changing it to true adds a class. This is the foundation of how the ng class works. If you want your animation to run at a certain interval, you need to switch using $ timeout. It's hard to tell by your code. The following example deletes a class using $ timeout, which runs after 2000 milliseconds.
http://plnkr.co/edit/Wtxkrv2nIqSLNfEsvCyI?p=preview
CSS .red { ; }
HTML
<!DOCTYPE html>
<html>
<head>
<script data-require="angular.js@*" data-semver="1.2.16" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body ng-controller="test">
<h1>Hello Plunker!</h1>
<span ng-class="{'red':animation.shake}">Hello World</span>
<button ng-click="shake()">red</button>
<script>
var app=angular.module("app",[]);
app.controller("test",function($scope,$timeout){
$scope.animation={shake:false};
$scope.shake=function(){
$scope.animation.shake=true;
$timeout(function(){
$scope.animation.shake=false;
},2000,true);
}
});
angular.bootstrap(document,["app"]);
</script>