希望这会有所帮助。
var myApp = angular.module('myApp', []);
myApp.controller('mainCtrl', ['$scope', '$timeout',
function($scope, $timeout) {
$scope.bgImage = 'url(http://www.larousse.fr/encyclopedie/data/images/1310226-Vincent_Van_Gogh_la_Nuit_%C3%A9toil%C3%A9e.jpg)';
var section = 12;
$scope.getNumber = function() {
return new Array(section);
}
$scope.getRotation = function(i) {
var hasMatrix = false, deg = 0, base = 360 / section, rotation;
if (i % 2 === 0) {
i -= 1;
hasMatrix = true;
}
deg = Math.round(i * base + 1);
if (section <= 4) {
deg -= 1;
}
rotation = 'rotate(' + deg + 'deg)';
if (hasMatrix) {
// Please updated this line
rotation += ' matrix(-1, 0, 0, 1, -1, 0)';
}
return rotation;
}
$scope.mode = 'move';
$scope.onMousemove = function(e) {
console.log($scope.mode);
if ($scope.mode === 'move') {
$scope.bgPosition = e.pageX + 'px ' + e.pageY + 'px';
}
};
}]);