ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Little presentation
Tess Hsu
? - what is angularsjs
? - Installation
? - How it works (< angulars 1.3)
? - How it works now (angulars 1.4)
? - Animate part Easy
? - Final
Angulars. Js is an open-source web application framework
maintained by Google 2012
Is a client-side MVC architecture.
Is two-way data binding for it¡¯s most notable feature with {{ }}
DOM control structures for repeating, showing and hiding DOM fragments
Support for forms and form validation
Attaching new behavior to DOM elements,such as DOM event handling
Grouping of HTML into reusable components.
? $ bower install --save angular-animate
? <script src=/slideshow/angular-animate/48918387/"js/vendor/angular.js"></script>
? <script src="js/vendor/angular-animate.js">
? </script>
? angular.module('myApp', ['ngAnimate']);
? The $animate service itself, by default,
applies two CSS classes to the animated
element for eachanimation event
? Directive Events: at least 2 events
? ngRepeat enter, leave, move
? ngView enter, leave
? ngInclude enter, leave
? ngSwitch enter, leave
? ngIf enter, leave
? ngClass or class=¡±¡­¡± add, remove
? ngShow add, remove (.ng-class)
? ngHide add, remove
? Html: <div class="fade-in"></div>
? Css: .fade-in { transition: 2s linear all;
? -webkit-transition: 2s linear all;
? }
? .fade-in.ng-enter {
? opacity: 0;
? }
? .fade-in.ng-enter.ng-enter-active {
? opacity: 1;
? }
? To actually run the animation,we need to include the CSS animation definition.In this
? definition, we need to include both the duration and the element attributes that we¡¯re
? going to modify.
? .fade-in.ng-enter { transition: 2s linear all; -webkit-transition: 2s
linear all; }
? When we bind the animation to the CSS element, we need to specify both the name
of the animation as well as the duration.
? Remember to add the animation duration: If we forget to add the duration of the
animation, the duration will default to 0, and the animation will not run.
? @keyframes firstAnimation {
? 0% { color: yellow; }
? 20% { color: yellow; }
? 40% { color: yellow; }
? 8 0% { color: yellow; }
100% {color: black ; }
? }
?
Html:
? <div ng-repeat="item in items" class="fade-in">Item: #1 -- {{ item }}</div>
? Css:
? .fade-in.ng-enter-stagger {
? -webkit-animation-delay:200ms; animation-delay:200ms;
? /* css stagger animations also needs to be here */
? -webkit-animation-duration:0; animation-duration:0;
? }
? .fade-in.ng-enter {
? /* pre-reflow styling */
? opacity:0;
? -webkit-animation: 2s firstAnimation;
? animation: 2s firstAnimation;
? }
? .fade-in.ng-enter-stagger { ... }
? @keyframes firstAnimation { ... }
? @-webkit-keyframes firstAnimation { ... }
? angular.module('myApp', ['ngAnimate']).animation('.fade-in', function() {
? return {
? enter: function(element, done) {
? // Run animation
? // call done when the animation is complete
? return function(cancelled) {
? // close or cancellation callback
? }
? }
? });
HTML:
<div ng-controller="HomeController">
? <ul>
? <li class="fade-in" ng-repeat="r in roommates¡±>{{ r }}</li>
? </ul>
? </div>
?HomeController:
? angular.module('myApp', ['ngAnimate']).controller('HomeController', function($scope) {
?
? $scope.roommates = ['Ari', 'Q', 'Sean', 'Anand¡¯];
? setTimeout(function() {
? $scope.roommates.push('Ginger');
? $scope.$apply(); // Trigger a digest
? setTimeout(function() {
? $scope.roommates.shift();
? $scope.$apply(); // Trigger digest
? }, 2000);
? }, 1000);
? });
? After we add css transitions/keyframe animation
? Or deal with javascript animation:
? define the enter/ leave properties on our animation description object
? angular.module('myApp¡¯).animation('.fade-in', function() {
?
? return {
? enter: function(element, done) {
? // Raw animation without jQuery
? // This is much simpler with jQuery
? var op = 0, timeout,animateFn = function() {
? op += 10;
? element.css('opacity', op/100);
? if (op >= 100) {
? clearInterval(timeout);
? done();
? }
? };
? // Set initial opacity to 0
? element.css('opacity', 0);
? timeout = setInterval(animateFn, 100);
? },
? leave: function(element, done) {
? var op = 100,
? timeout,animateFn = function() {
op-=10;
? element.css('opacity', op/100);
? if (op <= 0) {
? clearInterval(timeout);
? done();
? }
? };
? element.css('opacity', 100);
? timeout = setInterval(animateFn, 100);
? }
? }
? });
1. Basic Concept
$animateCss goal =
allow pre-existing animations or directive to create more complex
animations that can be purely driven using CSS code.
Example
Here we use animation called: fold-animate/ inject $animateCss and
return as an Object function
Example
the magic here is that $animateCss will detect automatically the duration
of transite since the css use linear value
3. What is returned
$anmateCss work in 2 stages: Preparation / Animation
Preparation: generated CSS classes:
added/ removed on the element
3. What is returned
$anmateCss work in 2 stages: Preparation / Animation
Preparation: generated CSS classes:
added/ removed on the element
Once $anmateCss is called it will return an object:
translate as like:
3. Hardcore part
still could not recongnise the differentces?
Here we could show some example
compare 1.4 version and less then 1.4 version
Use $animate directly instead of element definition
Once use $animate without call $scope.$apply() to see if any binding
values have changed, more flexable to excused!
That¡¯s see the practicle part without using jquery:
simply use $animateCss to add jquery animate through add / remove
Class, and duration, from one Css style to another ones.
Here is the one insert jquery one with 1.3 version:
another way inject the dependency $animateCss
another way inject the dependency $animateCss
Thanks for watch!!

More Related Content

What's hot (8)

Crush Candy with DukeScript
Crush Candy with DukeScriptCrush Candy with DukeScript
Crush Candy with DukeScript
Anton Epple
?
Make Your Animations Perform Well - JS Conf Budapest 2017
Make Your Animations Perform Well - JS Conf Budapest 2017 Make Your Animations Perform Well - JS Conf Budapest 2017
Make Your Animations Perform Well - JS Conf Budapest 2017
Anna Migas
?
Google I/O 2013 - Android Graphics Performance
Google I/O 2013 - Android Graphics PerformanceGoogle I/O 2013 - Android Graphics Performance
Google I/O 2013 - Android Graphics Performance
DouO
?
Flutter hooks tutorial (part 1) flutter animation using hooks (use effect and...
Flutter hooks tutorial (part 1) flutter animation using hooks (use effect and...Flutter hooks tutorial (part 1) flutter animation using hooks (use effect and...
Flutter hooks tutorial (part 1) flutter animation using hooks (use effect and...
Katy Slemon
?
Tips & Tricks to spice up your Android app
Tips & Tricks to spice up your Android appTips & Tricks to spice up your Android app
Tips & Tricks to spice up your Android app
J¨¦r¨¦mie Laval
?
JQuery - Effect - Animate method
JQuery - Effect - Animate methodJQuery - Effect - Animate method
JQuery - Effect - Animate method
Pathomchon Sriwilairit
?
Open Cv Tutorial Ii
Open Cv Tutorial IiOpen Cv Tutorial Ii
Open Cv Tutorial Ii
Waris Songtantarak
?
Quick ref capybara
Quick ref capybaraQuick ref capybara
Quick ref capybara
fatec
?
Crush Candy with DukeScript
Crush Candy with DukeScriptCrush Candy with DukeScript
Crush Candy with DukeScript
Anton Epple
?
Make Your Animations Perform Well - JS Conf Budapest 2017
Make Your Animations Perform Well - JS Conf Budapest 2017 Make Your Animations Perform Well - JS Conf Budapest 2017
Make Your Animations Perform Well - JS Conf Budapest 2017
Anna Migas
?
Google I/O 2013 - Android Graphics Performance
Google I/O 2013 - Android Graphics PerformanceGoogle I/O 2013 - Android Graphics Performance
Google I/O 2013 - Android Graphics Performance
DouO
?
Flutter hooks tutorial (part 1) flutter animation using hooks (use effect and...
Flutter hooks tutorial (part 1) flutter animation using hooks (use effect and...Flutter hooks tutorial (part 1) flutter animation using hooks (use effect and...
Flutter hooks tutorial (part 1) flutter animation using hooks (use effect and...
Katy Slemon
?
Tips & Tricks to spice up your Android app
Tips & Tricks to spice up your Android appTips & Tricks to spice up your Android app
Tips & Tricks to spice up your Android app
J¨¦r¨¦mie Laval
?
Quick ref capybara
Quick ref capybaraQuick ref capybara
Quick ref capybara
fatec
?

Similar to Angular animate (20)

14709302.ppt
14709302.ppt14709302.ppt
14709302.ppt
SunilChaluvaiah
?
How to Create Custom Animations in Flutter ¨C A Step-by-Step Guide.pdf
How to Create Custom Animations in Flutter ¨C A Step-by-Step Guide.pdfHow to Create Custom Animations in Flutter ¨C A Step-by-Step Guide.pdf
How to Create Custom Animations in Flutter ¨C A Step-by-Step Guide.pdf
BOSC Tech Labs
?
Tailwind Animation: How to Make Eye-Catching Websites
Tailwind Animation: How to Make Eye-Catching WebsitesTailwind Animation: How to Make Eye-Catching Websites
Tailwind Animation: How to Make Eye-Catching Websites
RonDosh
?
Workshop 18: CSS Animations & cool effects
Workshop 18: CSS Animations & cool effectsWorkshop 18: CSS Animations & cool effects
Workshop 18: CSS Animations & cool effects
Visual Engineering
?
JS.Chi CSS Animations
JS.Chi CSS AnimationsJS.Chi CSS Animations
JS.Chi CSS Animations
Justin Meyer
?
How to implement react native animations using animated api
How to implement react native animations using animated apiHow to implement react native animations using animated api
How to implement react native animations using animated api
Katy Slemon
?
I Can't Believe It's Not Flash
I Can't Believe It's Not FlashI Can't Believe It's Not Flash
I Can't Believe It's Not Flash
Thomas Fuchs
?
Learning Svelte
Learning SvelteLearning Svelte
Learning Svelte
Christoffer Noring
?
How to build a html5 websites.v1
How to build a html5 websites.v1How to build a html5 websites.v1
How to build a html5 websites.v1
Bitla Software
?
Massimo Artizzu - The tricks of Houdini: a magic wand for the future of CSS -...
Massimo Artizzu - The tricks of Houdini: a magic wand for the future of CSS -...Massimo Artizzu - The tricks of Houdini: a magic wand for the future of CSS -...
Massimo Artizzu - The tricks of Houdini: a magic wand for the future of CSS -...
Codemotion
?
Svcc 2013-d3
Svcc 2013-d3Svcc 2013-d3
Svcc 2013-d3
Oswald Campesato
?
SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)
Oswald Campesato
?
Make your animations perform well - Anna Migas - Codemotion Rome 2017
Make your animations perform well - Anna Migas - Codemotion Rome 2017Make your animations perform well - Anna Migas - Codemotion Rome 2017
Make your animations perform well - Anna Migas - Codemotion Rome 2017
Codemotion
?
Javascript Exercises
Javascript ExercisesJavascript Exercises
Javascript Exercises
SRINIVAS KOLAPARTHI
?
Day seven
Day sevenDay seven
Day seven
Vivek Bhusal
?
Android view animation in android-chapter18
Android view animation in android-chapter18Android view animation in android-chapter18
Android view animation in android-chapter18
Dr. Ramkumar Lakshminarayanan
?
HTML5: where flash isn't needed anymore
HTML5: where flash isn't needed anymoreHTML5: where flash isn't needed anymore
HTML5: where flash isn't needed anymore
Remy Sharp
?
Angular js animate shashikant bhongale -20-7-16
Angular js animate shashikant bhongale -20-7-16Angular js animate shashikant bhongale -20-7-16
Angular js animate shashikant bhongale -20-7-16
Shashikant Bhongale
?
±á°Õ²Ñ³¢5¤Ã¤Æ±ØÒª£¿
±á°Õ²Ñ³¢5¤Ã¤Æ±ØÒª£¿±á°Õ²Ñ³¢5¤Ã¤Æ±ØÒª£¿
±á°Õ²Ñ³¢5¤Ã¤Æ±ØÒª£¿
GCS2013
?
Building mobile web apps with Mobello
Building mobile web apps with MobelloBuilding mobile web apps with Mobello
Building mobile web apps with Mobello
Jeong-Geun Kim
?
How to Create Custom Animations in Flutter ¨C A Step-by-Step Guide.pdf
How to Create Custom Animations in Flutter ¨C A Step-by-Step Guide.pdfHow to Create Custom Animations in Flutter ¨C A Step-by-Step Guide.pdf
How to Create Custom Animations in Flutter ¨C A Step-by-Step Guide.pdf
BOSC Tech Labs
?
Tailwind Animation: How to Make Eye-Catching Websites
Tailwind Animation: How to Make Eye-Catching WebsitesTailwind Animation: How to Make Eye-Catching Websites
Tailwind Animation: How to Make Eye-Catching Websites
RonDosh
?
Workshop 18: CSS Animations & cool effects
Workshop 18: CSS Animations & cool effectsWorkshop 18: CSS Animations & cool effects
Workshop 18: CSS Animations & cool effects
Visual Engineering
?
JS.Chi CSS Animations
JS.Chi CSS AnimationsJS.Chi CSS Animations
JS.Chi CSS Animations
Justin Meyer
?
How to implement react native animations using animated api
How to implement react native animations using animated apiHow to implement react native animations using animated api
How to implement react native animations using animated api
Katy Slemon
?
I Can't Believe It's Not Flash
I Can't Believe It's Not FlashI Can't Believe It's Not Flash
I Can't Believe It's Not Flash
Thomas Fuchs
?
How to build a html5 websites.v1
How to build a html5 websites.v1How to build a html5 websites.v1
How to build a html5 websites.v1
Bitla Software
?
Massimo Artizzu - The tricks of Houdini: a magic wand for the future of CSS -...
Massimo Artizzu - The tricks of Houdini: a magic wand for the future of CSS -...Massimo Artizzu - The tricks of Houdini: a magic wand for the future of CSS -...
Massimo Artizzu - The tricks of Houdini: a magic wand for the future of CSS -...
Codemotion
?
SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)
Oswald Campesato
?
Make your animations perform well - Anna Migas - Codemotion Rome 2017
Make your animations perform well - Anna Migas - Codemotion Rome 2017Make your animations perform well - Anna Migas - Codemotion Rome 2017
Make your animations perform well - Anna Migas - Codemotion Rome 2017
Codemotion
?
HTML5: where flash isn't needed anymore
HTML5: where flash isn't needed anymoreHTML5: where flash isn't needed anymore
HTML5: where flash isn't needed anymore
Remy Sharp
?
Angular js animate shashikant bhongale -20-7-16
Angular js animate shashikant bhongale -20-7-16Angular js animate shashikant bhongale -20-7-16
Angular js animate shashikant bhongale -20-7-16
Shashikant Bhongale
?
±á°Õ²Ñ³¢5¤Ã¤Æ±ØÒª£¿
±á°Õ²Ñ³¢5¤Ã¤Æ±ØÒª£¿±á°Õ²Ñ³¢5¤Ã¤Æ±ØÒª£¿
±á°Õ²Ñ³¢5¤Ã¤Æ±ØÒª£¿
GCS2013
?
Building mobile web apps with Mobello
Building mobile web apps with MobelloBuilding mobile web apps with Mobello
Building mobile web apps with Mobello
Jeong-Geun Kim
?

Recently uploaded (20)

Artificial intelligence and Machine learning in remote sensing and GIS
Artificial intelligence  and Machine learning in remote sensing and GISArtificial intelligence  and Machine learning in remote sensing and GIS
Artificial intelligence and Machine learning in remote sensing and GIS
amirthamm2083
?
Virtual Power plants-Cleantech-Revolution
Virtual Power plants-Cleantech-RevolutionVirtual Power plants-Cleantech-Revolution
Virtual Power plants-Cleantech-Revolution
Ashoka Saket
?
Telehealth technology ¨C A new horizon in health care
Telehealth technology ¨C A new horizon in health careTelehealth technology ¨C A new horizon in health care
Telehealth technology ¨C A new horizon in health care
Dr INBAMALAR T M
?
Requirements Engineering for Secure Software
Requirements Engineering for Secure SoftwareRequirements Engineering for Secure Software
Requirements Engineering for Secure Software
Dr Sarika Jadhav
?
NBA Criteria TIER I and TIER II Comparison
NBA Criteria TIER I and TIER II ComparisonNBA Criteria TIER I and TIER II Comparison
NBA Criteria TIER I and TIER II Comparison
Dr INBAMALAR T M
?
Agentic architectures and workflows @ AIware Bootcamp 2024
Agentic architectures and workflows @ AIware Bootcamp 2024Agentic architectures and workflows @ AIware Bootcamp 2024
Agentic architectures and workflows @ AIware Bootcamp 2024
Keheliya Gallaba
?
Intro of Airport Engg..pptx-Definition of airport engineering and airport pla...
Intro of Airport Engg..pptx-Definition of airport engineering and airport pla...Intro of Airport Engg..pptx-Definition of airport engineering and airport pla...
Intro of Airport Engg..pptx-Definition of airport engineering and airport pla...
Priyanka Dange
?
UHV UNIT-3 HARMONY IN THE FAMILY AND SOCIETY.pptx
UHV UNIT-3 HARMONY IN THE FAMILY AND SOCIETY.pptxUHV UNIT-3 HARMONY IN THE FAMILY AND SOCIETY.pptx
UHV UNIT-3 HARMONY IN THE FAMILY AND SOCIETY.pptx
ariomthermal2031
?
Airport Components Part2 ppt.pptx-Apron,Hangers,Terminal building
Airport Components Part2 ppt.pptx-Apron,Hangers,Terminal buildingAirport Components Part2 ppt.pptx-Apron,Hangers,Terminal building
Airport Components Part2 ppt.pptx-Apron,Hangers,Terminal building
Priyanka Dange
?
applicationof differential equation.pptx
applicationof differential equation.pptxapplicationof differential equation.pptx
applicationof differential equation.pptx
PPSTUDIES
?
Software security: Security a Software Issue
Software security: Security a Software IssueSoftware security: Security a Software Issue
Software security: Security a Software Issue
Dr Sarika Jadhav
?
e-health to improve the effectiveness of the Healthcare system
e-health to improve the  effectiveness of the Healthcare systeme-health to improve the  effectiveness of the Healthcare system
e-health to improve the effectiveness of the Healthcare system
Dr INBAMALAR T M
?
GDGoC Artificial Intelligence Workshop.pptx
GDGoC Artificial Intelligence Workshop.pptxGDGoC Artificial Intelligence Workshop.pptx
GDGoC Artificial Intelligence Workshop.pptx
Aditi330605
?
Production Planning & Control and Inventory Management.pptx
Production Planning & Control and Inventory Management.pptxProduction Planning & Control and Inventory Management.pptx
Production Planning & Control and Inventory Management.pptx
VirajPasare
?
Water Industry Process Automation & Control Monthly - April 2025
Water Industry Process Automation & Control Monthly - April 2025Water Industry Process Automation & Control Monthly - April 2025
Water Industry Process Automation & Control Monthly - April 2025
Water Industry Process Automation & Control
?
02.BigDataAnalytics curso de Legsi (1).pdf
02.BigDataAnalytics curso de Legsi (1).pdf02.BigDataAnalytics curso de Legsi (1).pdf
02.BigDataAnalytics curso de Legsi (1).pdf
ruioliveira1921
?
Project Manager | Integrated Design Expert
Project Manager | Integrated Design ExpertProject Manager | Integrated Design Expert
Project Manager | Integrated Design Expert
BARBARA BIANCO
?
Industry 4.0: Transforming Modern Manufacturing and Beyond
Industry 4.0: Transforming Modern Manufacturing and BeyondIndustry 4.0: Transforming Modern Manufacturing and Beyond
Industry 4.0: Transforming Modern Manufacturing and Beyond
GtxDriver
?
Floating Offshore Wind in the Celtic Sea
Floating Offshore Wind in the Celtic SeaFloating Offshore Wind in the Celtic Sea
Floating Offshore Wind in the Celtic Sea
permagoveu
?
NFPA 70B & 70E Changes and Additions Webinar Presented By Fluke
NFPA 70B & 70E Changes and Additions Webinar Presented By FlukeNFPA 70B & 70E Changes and Additions Webinar Presented By Fluke
NFPA 70B & 70E Changes and Additions Webinar Presented By Fluke
Transcat
?
Artificial intelligence and Machine learning in remote sensing and GIS
Artificial intelligence  and Machine learning in remote sensing and GISArtificial intelligence  and Machine learning in remote sensing and GIS
Artificial intelligence and Machine learning in remote sensing and GIS
amirthamm2083
?
Virtual Power plants-Cleantech-Revolution
Virtual Power plants-Cleantech-RevolutionVirtual Power plants-Cleantech-Revolution
Virtual Power plants-Cleantech-Revolution
Ashoka Saket
?
Telehealth technology ¨C A new horizon in health care
Telehealth technology ¨C A new horizon in health careTelehealth technology ¨C A new horizon in health care
Telehealth technology ¨C A new horizon in health care
Dr INBAMALAR T M
?
Requirements Engineering for Secure Software
Requirements Engineering for Secure SoftwareRequirements Engineering for Secure Software
Requirements Engineering for Secure Software
Dr Sarika Jadhav
?
NBA Criteria TIER I and TIER II Comparison
NBA Criteria TIER I and TIER II ComparisonNBA Criteria TIER I and TIER II Comparison
NBA Criteria TIER I and TIER II Comparison
Dr INBAMALAR T M
?
Agentic architectures and workflows @ AIware Bootcamp 2024
Agentic architectures and workflows @ AIware Bootcamp 2024Agentic architectures and workflows @ AIware Bootcamp 2024
Agentic architectures and workflows @ AIware Bootcamp 2024
Keheliya Gallaba
?
Intro of Airport Engg..pptx-Definition of airport engineering and airport pla...
Intro of Airport Engg..pptx-Definition of airport engineering and airport pla...Intro of Airport Engg..pptx-Definition of airport engineering and airport pla...
Intro of Airport Engg..pptx-Definition of airport engineering and airport pla...
Priyanka Dange
?
UHV UNIT-3 HARMONY IN THE FAMILY AND SOCIETY.pptx
UHV UNIT-3 HARMONY IN THE FAMILY AND SOCIETY.pptxUHV UNIT-3 HARMONY IN THE FAMILY AND SOCIETY.pptx
UHV UNIT-3 HARMONY IN THE FAMILY AND SOCIETY.pptx
ariomthermal2031
?
Airport Components Part2 ppt.pptx-Apron,Hangers,Terminal building
Airport Components Part2 ppt.pptx-Apron,Hangers,Terminal buildingAirport Components Part2 ppt.pptx-Apron,Hangers,Terminal building
Airport Components Part2 ppt.pptx-Apron,Hangers,Terminal building
Priyanka Dange
?
applicationof differential equation.pptx
applicationof differential equation.pptxapplicationof differential equation.pptx
applicationof differential equation.pptx
PPSTUDIES
?
Software security: Security a Software Issue
Software security: Security a Software IssueSoftware security: Security a Software Issue
Software security: Security a Software Issue
Dr Sarika Jadhav
?
e-health to improve the effectiveness of the Healthcare system
e-health to improve the  effectiveness of the Healthcare systeme-health to improve the  effectiveness of the Healthcare system
e-health to improve the effectiveness of the Healthcare system
Dr INBAMALAR T M
?
GDGoC Artificial Intelligence Workshop.pptx
GDGoC Artificial Intelligence Workshop.pptxGDGoC Artificial Intelligence Workshop.pptx
GDGoC Artificial Intelligence Workshop.pptx
Aditi330605
?
Production Planning & Control and Inventory Management.pptx
Production Planning & Control and Inventory Management.pptxProduction Planning & Control and Inventory Management.pptx
Production Planning & Control and Inventory Management.pptx
VirajPasare
?
02.BigDataAnalytics curso de Legsi (1).pdf
02.BigDataAnalytics curso de Legsi (1).pdf02.BigDataAnalytics curso de Legsi (1).pdf
02.BigDataAnalytics curso de Legsi (1).pdf
ruioliveira1921
?
Project Manager | Integrated Design Expert
Project Manager | Integrated Design ExpertProject Manager | Integrated Design Expert
Project Manager | Integrated Design Expert
BARBARA BIANCO
?
Industry 4.0: Transforming Modern Manufacturing and Beyond
Industry 4.0: Transforming Modern Manufacturing and BeyondIndustry 4.0: Transforming Modern Manufacturing and Beyond
Industry 4.0: Transforming Modern Manufacturing and Beyond
GtxDriver
?
Floating Offshore Wind in the Celtic Sea
Floating Offshore Wind in the Celtic SeaFloating Offshore Wind in the Celtic Sea
Floating Offshore Wind in the Celtic Sea
permagoveu
?
NFPA 70B & 70E Changes and Additions Webinar Presented By Fluke
NFPA 70B & 70E Changes and Additions Webinar Presented By FlukeNFPA 70B & 70E Changes and Additions Webinar Presented By Fluke
NFPA 70B & 70E Changes and Additions Webinar Presented By Fluke
Transcat
?

Angular animate

  • 2. ? - what is angularsjs ? - Installation ? - How it works (< angulars 1.3) ? - How it works now (angulars 1.4) ? - Animate part Easy ? - Final
  • 3. Angulars. Js is an open-source web application framework maintained by Google 2012 Is a client-side MVC architecture. Is two-way data binding for it¡¯s most notable feature with {{ }} DOM control structures for repeating, showing and hiding DOM fragments Support for forms and form validation Attaching new behavior to DOM elements,such as DOM event handling Grouping of HTML into reusable components.
  • 4. ? $ bower install --save angular-animate ? <script src=/slideshow/angular-animate/48918387/"js/vendor/angular.js"></script> ? <script src="js/vendor/angular-animate.js"> ? </script> ? angular.module('myApp', ['ngAnimate']);
  • 5. ? The $animate service itself, by default, applies two CSS classes to the animated element for eachanimation event ? Directive Events: at least 2 events ? ngRepeat enter, leave, move ? ngView enter, leave ? ngInclude enter, leave ? ngSwitch enter, leave ? ngIf enter, leave ? ngClass or class=¡±¡­¡± add, remove ? ngShow add, remove (.ng-class) ? ngHide add, remove
  • 6. ? Html: <div class="fade-in"></div> ? Css: .fade-in { transition: 2s linear all; ? -webkit-transition: 2s linear all; ? } ? .fade-in.ng-enter { ? opacity: 0; ? } ? .fade-in.ng-enter.ng-enter-active { ? opacity: 1; ? } ? To actually run the animation,we need to include the CSS animation definition.In this ? definition, we need to include both the duration and the element attributes that we¡¯re ? going to modify. ? .fade-in.ng-enter { transition: 2s linear all; -webkit-transition: 2s linear all; }
  • 7. ? When we bind the animation to the CSS element, we need to specify both the name of the animation as well as the duration. ? Remember to add the animation duration: If we forget to add the duration of the animation, the duration will default to 0, and the animation will not run. ? @keyframes firstAnimation { ? 0% { color: yellow; } ? 20% { color: yellow; } ? 40% { color: yellow; } ? 8 0% { color: yellow; } 100% {color: black ; } ? }
  • 8. ? Html: ? <div ng-repeat="item in items" class="fade-in">Item: #1 -- {{ item }}</div> ? Css: ? .fade-in.ng-enter-stagger { ? -webkit-animation-delay:200ms; animation-delay:200ms; ? /* css stagger animations also needs to be here */ ? -webkit-animation-duration:0; animation-duration:0; ? } ? .fade-in.ng-enter { ? /* pre-reflow styling */ ? opacity:0; ? -webkit-animation: 2s firstAnimation; ? animation: 2s firstAnimation; ? } ? .fade-in.ng-enter-stagger { ... } ? @keyframes firstAnimation { ... } ? @-webkit-keyframes firstAnimation { ... }
  • 9. ? angular.module('myApp', ['ngAnimate']).animation('.fade-in', function() { ? return { ? enter: function(element, done) { ? // Run animation ? // call done when the animation is complete ? return function(cancelled) { ? // close or cancellation callback ? } ? } ? });
  • 10. HTML: <div ng-controller="HomeController"> ? <ul> ? <li class="fade-in" ng-repeat="r in roommates¡±>{{ r }}</li> ? </ul> ? </div> ?HomeController: ? angular.module('myApp', ['ngAnimate']).controller('HomeController', function($scope) { ? ? $scope.roommates = ['Ari', 'Q', 'Sean', 'Anand¡¯]; ? setTimeout(function() { ? $scope.roommates.push('Ginger'); ? $scope.$apply(); // Trigger a digest ? setTimeout(function() { ? $scope.roommates.shift(); ? $scope.$apply(); // Trigger digest ? }, 2000); ? }, 1000); ? });
  • 11. ? After we add css transitions/keyframe animation ? Or deal with javascript animation: ? define the enter/ leave properties on our animation description object ? angular.module('myApp¡¯).animation('.fade-in', function() { ? ? return { ? enter: function(element, done) { ? // Raw animation without jQuery ? // This is much simpler with jQuery ? var op = 0, timeout,animateFn = function() { ? op += 10; ? element.css('opacity', op/100); ? if (op >= 100) { ? clearInterval(timeout); ? done(); ? } ? }; ? // Set initial opacity to 0 ? element.css('opacity', 0);
  • 12. ? timeout = setInterval(animateFn, 100); ? }, ? leave: function(element, done) { ? var op = 100, ? timeout,animateFn = function() { op-=10; ? element.css('opacity', op/100); ? if (op <= 0) { ? clearInterval(timeout); ? done(); ? } ? }; ? element.css('opacity', 100); ? timeout = setInterval(animateFn, 100); ? } ? } ? });
  • 13. 1. Basic Concept $animateCss goal = allow pre-existing animations or directive to create more complex animations that can be purely driven using CSS code.
  • 14. Example Here we use animation called: fold-animate/ inject $animateCss and return as an Object function
  • 15. Example the magic here is that $animateCss will detect automatically the duration of transite since the css use linear value
  • 16. 3. What is returned $anmateCss work in 2 stages: Preparation / Animation Preparation: generated CSS classes: added/ removed on the element
  • 17. 3. What is returned $anmateCss work in 2 stages: Preparation / Animation Preparation: generated CSS classes: added/ removed on the element Once $anmateCss is called it will return an object:
  • 19. 3. Hardcore part still could not recongnise the differentces? Here we could show some example compare 1.4 version and less then 1.4 version
  • 20. Use $animate directly instead of element definition
  • 21. Once use $animate without call $scope.$apply() to see if any binding values have changed, more flexable to excused! That¡¯s see the practicle part without using jquery:
  • 22. simply use $animateCss to add jquery animate through add / remove Class, and duration, from one Css style to another ones. Here is the one insert jquery one with 1.3 version:
  • 23. another way inject the dependency $animateCss
  • 24. another way inject the dependency $animateCss