Как создать пользовательскую анимацию в AngularJS?
@ladarius.greenholt
1 2 3 4 5 6 7 8 |
angular.module('myApp').directive('myAnimation', function() { return { restrict: 'A', link: function(scope, element, attrs) { // код для анимации } }; }); |
1 2 3 4 5 6 7 8 |
angular.module('myApp').directive('myAnimation', function() { return { restrict: 'A', link: function(scope, element, attrs) { element.addClass('my-animation-class'); } }; }); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
.my-animation-class { animation-name: my-animation; animation-duration: 2s; animation-iteration-count: infinite; } @keyframes my-animation { 0% { transform: scale(1); } 50% { transform: scale(1.2); } 100% { transform: scale(1); } } |
1
|
@ladarius.greenholt
Существует несколько способов создания пользовательской анимации в AngularJS.