Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
AngularJS DirectiveでAnimate
Search
Tessei Yoshida
December 03, 2013
Technology
2
450
AngularJS DirectiveでAnimate
DirectiveでngAnimateを利用する方法を簡単に紹介
Tessei Yoshida
December 03, 2013
Tweet
Share
More Decks by Tessei Yoshida
See All by Tessei Yoshida
Angular Universalの歩き方
teyosh
0
190
型を使うと便利な開発
teyosh
0
3k
第64回 HTML5とか勉強会 〜 Angular特集 〜
teyosh
0
580
Angular2を書くためのAngularJSの書き方
teyosh
3
8.2k
express 用 framework genieについて
teyosh
0
2.9k
はじめてのAngularJS
teyosh
1
840
Other Decks in Technology
See All in Technology
ソフトウェアエンジニアとAIエンジニアの役割分担についてのある事例
kworkdev
PRO
0
210
アラフォーおじさん、はじめてre:Inventに行く / A 40-Something Guy’s First re:Invent Adventure
kaminashi
0
130
投資戦略を量産せよ 2 - マケデコセミナー(2025/12/26)
gamella
0
210
株式会社ビザスク_AI__Engineering_Summit_Tokyo_2025_登壇資料.pdf
eikohashiba
1
110
202512_AIoT.pdf
iotcomjpadmin
0
140
100以上の新規コネクタ提供を可能にしたアーキテクチャ
ooyukioo
0
240
20251219 OpenIDファウンデーション・ジャパン紹介 / OpenID Foundation Japan Intro
oidfj
0
480
AIエージェント開発と活用を加速するワークフロー自動生成への挑戦
shibuiwilliam
4
830
Building Serverless AI Memory with Mastra × AWS
vvatanabe
0
400
Microsoft Agent Frameworkの可観測性
tomokusaba
1
110
『君の名は』と聞く君の名は。 / Your name, you who asks for mine.
nttcom
1
110
なぜ あなたはそんなに re:Invent に行くのか?
miu_crescent
PRO
0
190
Featured
See All Featured
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
120
Become a Pro
speakerdeck
PRO
31
5.7k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.8k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.2k
Leo the Paperboy
mayatellez
0
1.2k
Highjacked: Video Game Concept Design
rkendrick25
PRO
0
250
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
0
300
The Pragmatic Product Professional
lauravandoore
37
7.1k
HDC tutorial
michielstock
0
260
The Power of CSS Pseudo Elements
geoffreycrofte
80
6.1k
How to train your dragon (web standard)
notwaldorf
97
6.4k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Transcript
AngularJS LT DirectiveにngAnimateをつけよう
自己紹介 吉田徹生(よしだてっせい) @teyosh
AngularJS使ってますか? 11月に1.2が公開されました。
1.2 追加で待望のngAnimateが公 式モジュールとして追加されま した。
Extrasのディレクトリ
ngAnimateの基本 ngAnimateを読み込む angular.module("mainAnime", ["ngAnimate"])
用意してされているng-* ng-repeat ng-show ng-hide ng-if ng-view ng-include
例 : ng-repeat ng-repeat対象の配列に追加削除した際にアニ メーションを付ける <div class=”smain-animation” ng-repeat=”item in items
track by $index”>{{item}}</div>
CSS3でアニメーション .smain-animation {left : 100px; position:relative; -webkit-transition:0.5s linear all;} .smain-animation.ng-enter,
.smain-animation.ng-leave.ng-leave-active {left:-100px;} .smain-animation.ng-enter.ng-enter-active, .smain-animation.ng-leave { left:100px; }
JavaScriptでアニメーション .animation('.main-animation', function(){ return { enter: function(element, done){ $(element).css({left :
-100}); $(element).animate({left : 50},done); }, leave : function(element, done){ $(element).animate({left : 0},done); } }; })
Directiveにアニメーション もちろん自作のDirectiveにもア ニメーションを設定できます。
$animateで設定 $animateで実行されます。 $animate.enter(element, parent, after, callback); $animate.leave(element, callback); $animate.move(element, parent,
after, callback); $animate.addClass(element, className, callback); $animate.removeClass(element, className, callback);
こんなかんじでDirective .directive("mainAnimation", ["$animate", function($animate){ return { restrict: "A", template: "<button
ng-click='enteranime()'>enter</button><button ng- click='leaveanime()'>leave</button>", link: function(scope, element, attr){ scope.spans = [];
続き enter追加 scope.enteranime = function(){ var $test = angular.element("<div class=\"main-animation\">test</div>");
var $after = angular.element(element.children()[element.children().length- 1]); $animate.enter($test, element, $after, function(){ scope.spans.push($test); }); };
続き leave追加 scope.leaveanime = function(){ if(scope.spans.length){ $animate.leave(scope.spans.pop()); } }; }
}; }])
出来たのはこちら http://plnkr. co/edit/MlEVCWFvEWWAMdZkPcSV? p=preview