Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
AngularJS DirectiveでAnimate
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Tessei Yoshida
December 03, 2013
Technology
460
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
AngularJS DirectiveでAnimate
DirectiveでngAnimateを利用する方法を簡単に紹介
Tessei Yoshida
December 03, 2013
More Decks by Tessei Yoshida
See All by Tessei Yoshida
Angular Universalの歩き方
teyosh
0
230
型を使うと便利な開発
teyosh
0
3.1k
第64回 HTML5とか勉強会 〜 Angular特集 〜
teyosh
0
610
Angular2を書くためのAngularJSの書き方
teyosh
3
8.3k
express 用 framework genieについて
teyosh
0
3k
はじめてのAngularJS
teyosh
1
880
Other Decks in Technology
See All in Technology
取引先から届く 「セキュリティチェックシート」の読み解き方
kamadamakoto
0
110
オートロックマンションなのに、各部屋は施錠なし!? 攻撃者が組織内ネットワークで大暴れする理由 / The Front Door Is Locked, but the Rooms Are Wide Open: Why Attackers Move Freely Inside Enterprise Networks
nttcom
0
1.5k
Webアクセシビリティ入門 2026
recruitengineers
PRO
1
280
LLMリーダーボードアップデートに向けたAgentic Math_SWEのトレースについて
nejumi
0
210
【CEDEC2026】次世代デジタルカードゲームのサーバー設計と運用 〜『Shadowverse: Worlds Beyond』の舞台裏~
cygames
PRO
0
850
Retriever と Reranker、結局どうする?
kazuaki
2
670
[しろおび夏祭り2026] チャットするAIから、作業するAIへ - 使われ方の変化と、その裏側で起きていること
kk0n
0
1.6k
SnowflakeCoCoでデータエンジニアリング!
foursue
0
180
【Google Cloud Next Tokyo'26】Gemini Enterprise と Oracle AI Database で実現する、業務データ活用を実現する AI エージェント実装
shisyu_gaku
0
210
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1.2k
モノリス Rails でも日中に rails db:migrate を走らせたい! / Daytime rails db:migrate on Monolithic Rails!
euglena1215
3
440
TypeScript入門 2026
recruitengineers
PRO
1
300
Featured
See All Featured
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
530
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
360
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Test your architecture with Archunit
thirion
1
2.3k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
420
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
570
Building Adaptive Systems
keathley
44
3.2k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.3k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
820
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