SlideShare a Scribd company logo
LIQUID FIRE TOOLKIT
AN INTRODUCTION TO ANIMATIONS IN
EMBER
By William Bergamo / @bugduino
LIQUID FIRE
Ember-cli addon made by
Manage animations and transitions
It includes some default animations and
helpers
Under the hood uses
ef4
Velocity.js
KEY IDEA
Transitions should be implemented in views.
But who is in charge to decide what kind of transition to
use?
TRANSITION MAP
e x p o r t d e f a u l t f u n c t i o n ( ) {
t h i s . t r a n s i t i o n (
t h i s . f r o m R o u t e ( ' b a r ' ) ,
t h i s . t o R o u t e ( ' f o o ' ) ,
t h i s . u s e ( ' t o L e f t ' ) ,
t h i s . r e v e r s e ( ' t o R i g h t ' )
) ;
t h i s . t r a n s i t i o n (
t h i s . f r o m R o u t e ( ' b a z ' ) ,
t h i s . u s e ( ' t o U p ' ) ,
) ;
/ / . . .
}
Contains rules about how app pieces relate to each
other
Similar to The Ember router map
LIQUID FIRE COMPONENTS
Template
helpers
Transition map
Transitions
TEMPLATE HELPERS
{{liquid-outlet}}
{{liquid-with}}
{{liquid-bind}}
{{liquid-if}} / {{liquid-unless}}
{{liquid-spacer}}
HELPERS COMMON BEHAVIOR
Generate some DOM elements
They consult the transition map
use, class and growDuration
options
< d i v c l a s s = " l i q u i d - c o n t a i n e r " >
< d i v c l a s s = " l i q u i d - c h i l d " >
/ / C o n t e n t
< / d i v >
< / d i v >
LIQUID OUTLET
Animates between routes transition
LIQUID WITH
Animates the transition between different models on the
same route
LIQUID BIND
{{liquid-bind someProp}} it's the equivalent of {{someProp}},
the helper animates between value changes
LIQUID IF
Works like the normal ember IF helper and animates when
the value changes from true to false or the opposite
LIQUID SPACER
Do not have an equivalent Ember helper
Do not search in transition map for matching
rules
It just animates it's own width and height
changes
TRANSITION MAP
You can configure rules that govern which animations run at
any given moment.
The map must be located in app/transitions.js
It gives access to functions:
transition creates a transition rule with one or more
constraints and a use statement.
setDefault is used to provide default setting to Velocity.js
(e.g duration, easing, etc.)
CREATE RULES FOR ROUTES
fromRoute, toRoute, withinRoute are available for the
liquid-outlet
Possible parameters: route name, functions, array, null
t h i s . t r a n s i t i o n ( t h i s . f r o m R o u t e ( ' b a r ' ) , t o R o u t e ( ' f o o ' ) ,
t h i s . u s e ( ' t o L e f t ' ) ) ;
t h i s . t r a n s i t i o n (
t h i s . f r o m R o u t e ( r o u t e N a m e = > r o u t e N a m e . i n c l u d e s ( ' o o ' ) ) ,
t h i s . u s e ( ' t o L e f t ' ) ) ;
t h i s . t r a n s i t i o n (
t h i s . f r o m R o u t e ( [ ' f o o ' , ' b a r ' , r o u t e N a m e = > r o u t e N a m e = = = ' b a z ' ] ) ,
t h i s . u s e ( ' t o D o w n ' ) ) ;
t h i s . t r a n s i t i o n ( t h i s . f r o m R o u t e ( n u l l ) , t h i s . t o R o u t e ( ' b a r ' ) ,
t h i s . u s e ( ' t o U p ' ) ) ;
CREATE RULES FOR MODELS
fromModel
toModel
betweenModel
Possible parameters: same as before.
CREATE RULES FOR VALUES
fromValue
toValue
betweenValues
They accept only one parameter: function, regexp, boolean,
string, number or null (which will match null or undefined)
hasClass
CREATE RULES FOR DOM
< d i v i d = " c o n t a i n e r " >
{ { l i q u i d - i f i s O p e n c l a s s = " s p a c e r " } } o p e n { { / l i q u i d - i f } }
< / d i v >
t h i s . t r a n s i t i o n ( t h i s . h a s C l a s s ( ' s p a c e r ' ) , t h i s . u s e ( ' t o D o w n ' ) )
matchSelector
t h i s . t r a n s i t i o n ( t h i s . m a t c h S e l e c t o r ( ' . s p a c e r ' ) , t h i s . u s e ( ' t o D o w n ' ) )
childOf
t h i s . t r a n s i t i o n ( t h i s . c h i l d O f ( ' # c o n t a i n e r ' ) , t h i s . u s e ( ' t o D o w n ' ) )
inHelper
t h i s . t r a n s i t i o n ( t h i s . i n H e l p e r ( ' l i q u i d - i f ' ) , t h i s . u s e ( ' t o D o w n ' ) )
TRANSITIONS
implement animation between two states, manipulate the
DOM to pass from the old view's value to the new one.
PREDEFINED
toLeft, toRight, toDown,
toUp
fade, crossFade
explode
fly-to
EXPLODE
You can animate every single piece of the template.
It accepts any number of objects as argument, and every
object must have a use property.
t h i s . t r a n s i t i o n (
t h i s . c h i l d O f ( ' # c o n t a i n e r ' ) ,
t h i s . u s e ( ' e x p l o d e ' , {
p i c k N e w : ' . s p a c e r ' , u s e : ' t o D o w n '
} , {
p i c k N e w : ' . b r e a d c r u m b s ' , u s e : ' t o L e f t '
} , { / / f o r a l l o t h e r e l e m e n t s
u s e : ' f a d e '
}
}
CUSTOM TRANSITIONS
Must be located in app/transitions/transition-name.js
There are different animation primitives available
i m p o r t { s t o p , a n i m a t e , P r o m i s e } f r o m " l i q u i d - f i r e " ;
e x p o r t d e f a u l t f u n c t i o n r o t a t e B e l o w ( o p t s = { } ) {
v a r d i r e c t i o n = 1 ;
i f ( o p t s . d i r e c t i o n = = = ' c w ' ) {
d i r e c t i o n = - 1 ;
}
s t o p ( t h i s . o l d E l e m e n t ) ;
i f ( t h i s . o l d E l e m e n t ) {
t h i s . o l d E l e m e n t . c s s ( ' t r a n s f o r m - o r i g i n ' , ' 5 0 % 1 5 0 % ' ) ;
}
i f ( t h i s . n e w E l e m e n t ) {
t h i s . n e w E l e m e n t . c s s ( ' t r a n s f o r m - o r i g i n ' , ' 5 0 % 1 5 0 % ' ) ;
}
r e t u r n P r o m i s e . a l l ( [
a n i m a t e ( t h i s . o l d E l e m e n t , { r o t a t e Z : - 9 0 * d i r e c t i o n + ' d e g ' } , o p t s ) ,
a n i m a t e ( t h i s . n e w E l e m e n t , { r o t a t e Z : [ ' 0 d e g ' , 9 0 * d i r e c t i o n + ' d e g ' ] } , o p t s )
PROBLEMS ENCOUNTERED
Not all feature are available in oldStable
branch
overflow: hidden
'hidden' features -> liquid-animating
Bug with position: fixed and chrome
PR#209
Issue#197
Quick fixes
. l i q u i d - c o n t a i n e r . l i q u i d - a n i m a t i n g {
o v e r f l o w : h i d d e n ;
}
. l i q u i d - c o n t a i n e r > . l i q u i d - c h i l d ,
. l i q u i d - c o n t a i n e r {
t r a n s f o r m : i n i t i a l ;
o v e r f l o w : i n i t i a l ;
}
EXAMPLES
Contacts:
THANK YOU!
@bugduino
www.pitchtarget.com
http://hackatron.org/
Ember.js Treviso Meetup

More Related Content

Similar to Ember js meetup treviso liquid-fire

Piotr Szotkowski about "Ruby smells"
Piotr Szotkowski about "Ruby smells"Piotr Szotkowski about "Ruby smells"
Piotr Szotkowski about "Ruby smells"
Pivorak MeetUp
 
Breathe life into your designer!
Breathe life into your designer!Breathe life into your designer!
Breathe life into your designer!
Cédric Brun
 
Spring Roo 2.0 Preview at Spring I/O 2016
Spring Roo 2.0 Preview at Spring I/O 2016 Spring Roo 2.0 Preview at Spring I/O 2016
Spring Roo 2.0 Preview at Spring I/O 2016
DISID
 
GraphQL Relay Introduction
GraphQL Relay IntroductionGraphQL Relay Introduction
GraphQL Relay Introduction
Chen-Tsu Lin
 
JavaFX, because you're worth it
JavaFX, because you're worth itJavaFX, because you're worth it
JavaFX, because you're worth it
Thierry Wasylczenko
 
PostgreSQL Day italy 2016 Unit Test
PostgreSQL Day italy 2016 Unit TestPostgreSQL Day italy 2016 Unit Test
PostgreSQL Day italy 2016 Unit Test
Andrea Adami
 
Modeling avengers – open source technology mix for saving the world econ fr
Modeling avengers – open source technology mix for saving the world econ frModeling avengers – open source technology mix for saving the world econ fr
Modeling avengers – open source technology mix for saving the world econ fr
Cédric Brun
 
Introduction to Compiler Development
Introduction to Compiler DevelopmentIntroduction to Compiler Development
Introduction to Compiler Development
Logan Chien
 
Modeling avengers – open source technology mix for saving the world
Modeling avengers – open source technology mix for saving the worldModeling avengers – open source technology mix for saving the world
Modeling avengers – open source technology mix for saving the world
Cédric Brun
 
Advanced QUnit - Front-End JavaScript Unit Testing
Advanced QUnit - Front-End JavaScript Unit TestingAdvanced QUnit - Front-End JavaScript Unit Testing
Advanced QUnit - Front-End JavaScript Unit Testing
Lars Thorup
 
Hardware Description Languages .pptx
Hardware Description Languages .pptxHardware Description Languages .pptx
Hardware Description Languages .pptx
wafawafa52
 
PyLadies Talk: Learn to love the command line!
PyLadies Talk: Learn to love the command line!PyLadies Talk: Learn to love the command line!
PyLadies Talk: Learn to love the command line!
Blanca Mancilla
 
Writing (Meteor) Code With Style
Writing (Meteor) Code With StyleWriting (Meteor) Code With Style
Writing (Meteor) Code With Style
Stephan Hochhaus
 
Using TypeScript at Dashlane
Using TypeScript at DashlaneUsing TypeScript at Dashlane
Using TypeScript at Dashlane
Dashlane
 
Piotr Szotkowski about "Bits of ruby"
Piotr Szotkowski about "Bits of ruby"Piotr Szotkowski about "Bits of ruby"
Piotr Szotkowski about "Bits of ruby"
Pivorak MeetUp
 
PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet
PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet
PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet
Pôle Systematic Paris-Region
 
No Flex Zone: Empathy Driven Development
No Flex Zone: Empathy Driven DevelopmentNo Flex Zone: Empathy Driven Development
No Flex Zone: Empathy Driven Development
Duretti H.
 
10 Billion a Day, 100 Milliseconds Per: Monitoring Real-Time Bidding at AdRoll
10 Billion a Day, 100 Milliseconds Per: Monitoring Real-Time Bidding at AdRoll10 Billion a Day, 100 Milliseconds Per: Monitoring Real-Time Bidding at AdRoll
10 Billion a Day, 100 Milliseconds Per: Monitoring Real-Time Bidding at AdRoll
Brian Troutwine
 
Type Systems on the example of TypeScript
Type Systems on the example of TypeScriptType Systems on the example of TypeScript
Type Systems on the example of TypeScript
Artur Skowroński
 
Spring scala - Sneaking Scala into your corporation
Spring scala  - Sneaking Scala into your corporationSpring scala  - Sneaking Scala into your corporation
Spring scala - Sneaking Scala into your corporationHenryk Konsek
 

Similar to Ember js meetup treviso liquid-fire (20)

Piotr Szotkowski about "Ruby smells"
Piotr Szotkowski about "Ruby smells"Piotr Szotkowski about "Ruby smells"
Piotr Szotkowski about "Ruby smells"
 
Breathe life into your designer!
Breathe life into your designer!Breathe life into your designer!
Breathe life into your designer!
 
Spring Roo 2.0 Preview at Spring I/O 2016
Spring Roo 2.0 Preview at Spring I/O 2016 Spring Roo 2.0 Preview at Spring I/O 2016
Spring Roo 2.0 Preview at Spring I/O 2016
 
GraphQL Relay Introduction
GraphQL Relay IntroductionGraphQL Relay Introduction
GraphQL Relay Introduction
 
JavaFX, because you're worth it
JavaFX, because you're worth itJavaFX, because you're worth it
JavaFX, because you're worth it
 
PostgreSQL Day italy 2016 Unit Test
PostgreSQL Day italy 2016 Unit TestPostgreSQL Day italy 2016 Unit Test
PostgreSQL Day italy 2016 Unit Test
 
Modeling avengers – open source technology mix for saving the world econ fr
Modeling avengers – open source technology mix for saving the world econ frModeling avengers – open source technology mix for saving the world econ fr
Modeling avengers – open source technology mix for saving the world econ fr
 
Introduction to Compiler Development
Introduction to Compiler DevelopmentIntroduction to Compiler Development
Introduction to Compiler Development
 
Modeling avengers – open source technology mix for saving the world
Modeling avengers – open source technology mix for saving the worldModeling avengers – open source technology mix for saving the world
Modeling avengers – open source technology mix for saving the world
 
Advanced QUnit - Front-End JavaScript Unit Testing
Advanced QUnit - Front-End JavaScript Unit TestingAdvanced QUnit - Front-End JavaScript Unit Testing
Advanced QUnit - Front-End JavaScript Unit Testing
 
Hardware Description Languages .pptx
Hardware Description Languages .pptxHardware Description Languages .pptx
Hardware Description Languages .pptx
 
PyLadies Talk: Learn to love the command line!
PyLadies Talk: Learn to love the command line!PyLadies Talk: Learn to love the command line!
PyLadies Talk: Learn to love the command line!
 
Writing (Meteor) Code With Style
Writing (Meteor) Code With StyleWriting (Meteor) Code With Style
Writing (Meteor) Code With Style
 
Using TypeScript at Dashlane
Using TypeScript at DashlaneUsing TypeScript at Dashlane
Using TypeScript at Dashlane
 
Piotr Szotkowski about "Bits of ruby"
Piotr Szotkowski about "Bits of ruby"Piotr Szotkowski about "Bits of ruby"
Piotr Szotkowski about "Bits of ruby"
 
PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet
PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet
PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet
 
No Flex Zone: Empathy Driven Development
No Flex Zone: Empathy Driven DevelopmentNo Flex Zone: Empathy Driven Development
No Flex Zone: Empathy Driven Development
 
10 Billion a Day, 100 Milliseconds Per: Monitoring Real-Time Bidding at AdRoll
10 Billion a Day, 100 Milliseconds Per: Monitoring Real-Time Bidding at AdRoll10 Billion a Day, 100 Milliseconds Per: Monitoring Real-Time Bidding at AdRoll
10 Billion a Day, 100 Milliseconds Per: Monitoring Real-Time Bidding at AdRoll
 
Type Systems on the example of TypeScript
Type Systems on the example of TypeScriptType Systems on the example of TypeScript
Type Systems on the example of TypeScript
 
Spring scala - Sneaking Scala into your corporation
Spring scala  - Sneaking Scala into your corporationSpring scala  - Sneaking Scala into your corporation
Spring scala - Sneaking Scala into your corporation
 

Recently uploaded

Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Jay Das
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 

Recently uploaded (20)

Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 

Ember js meetup treviso liquid-fire

  • 1. LIQUID FIRE TOOLKIT AN INTRODUCTION TO ANIMATIONS IN EMBER By William Bergamo / @bugduino
  • 2. LIQUID FIRE Ember-cli addon made by Manage animations and transitions It includes some default animations and helpers Under the hood uses ef4 Velocity.js
  • 3. KEY IDEA Transitions should be implemented in views. But who is in charge to decide what kind of transition to use?
  • 4. TRANSITION MAP e x p o r t d e f a u l t f u n c t i o n ( ) { t h i s . t r a n s i t i o n ( t h i s . f r o m R o u t e ( ' b a r ' ) , t h i s . t o R o u t e ( ' f o o ' ) , t h i s . u s e ( ' t o L e f t ' ) , t h i s . r e v e r s e ( ' t o R i g h t ' ) ) ; t h i s . t r a n s i t i o n ( t h i s . f r o m R o u t e ( ' b a z ' ) , t h i s . u s e ( ' t o U p ' ) , ) ; / / . . . } Contains rules about how app pieces relate to each other Similar to The Ember router map
  • 7. HELPERS COMMON BEHAVIOR Generate some DOM elements They consult the transition map use, class and growDuration options < d i v c l a s s = " l i q u i d - c o n t a i n e r " > < d i v c l a s s = " l i q u i d - c h i l d " > / / C o n t e n t < / d i v > < / d i v >
  • 8. LIQUID OUTLET Animates between routes transition LIQUID WITH Animates the transition between different models on the same route LIQUID BIND {{liquid-bind someProp}} it's the equivalent of {{someProp}}, the helper animates between value changes
  • 9. LIQUID IF Works like the normal ember IF helper and animates when the value changes from true to false or the opposite LIQUID SPACER Do not have an equivalent Ember helper Do not search in transition map for matching rules It just animates it's own width and height changes
  • 10. TRANSITION MAP You can configure rules that govern which animations run at any given moment. The map must be located in app/transitions.js It gives access to functions: transition creates a transition rule with one or more constraints and a use statement. setDefault is used to provide default setting to Velocity.js (e.g duration, easing, etc.)
  • 11. CREATE RULES FOR ROUTES fromRoute, toRoute, withinRoute are available for the liquid-outlet Possible parameters: route name, functions, array, null t h i s . t r a n s i t i o n ( t h i s . f r o m R o u t e ( ' b a r ' ) , t o R o u t e ( ' f o o ' ) , t h i s . u s e ( ' t o L e f t ' ) ) ; t h i s . t r a n s i t i o n ( t h i s . f r o m R o u t e ( r o u t e N a m e = > r o u t e N a m e . i n c l u d e s ( ' o o ' ) ) , t h i s . u s e ( ' t o L e f t ' ) ) ; t h i s . t r a n s i t i o n ( t h i s . f r o m R o u t e ( [ ' f o o ' , ' b a r ' , r o u t e N a m e = > r o u t e N a m e = = = ' b a z ' ] ) , t h i s . u s e ( ' t o D o w n ' ) ) ; t h i s . t r a n s i t i o n ( t h i s . f r o m R o u t e ( n u l l ) , t h i s . t o R o u t e ( ' b a r ' ) , t h i s . u s e ( ' t o U p ' ) ) ;
  • 12. CREATE RULES FOR MODELS fromModel toModel betweenModel Possible parameters: same as before. CREATE RULES FOR VALUES fromValue toValue betweenValues They accept only one parameter: function, regexp, boolean, string, number or null (which will match null or undefined)
  • 13. hasClass CREATE RULES FOR DOM < d i v i d = " c o n t a i n e r " > { { l i q u i d - i f i s O p e n c l a s s = " s p a c e r " } } o p e n { { / l i q u i d - i f } } < / d i v > t h i s . t r a n s i t i o n ( t h i s . h a s C l a s s ( ' s p a c e r ' ) , t h i s . u s e ( ' t o D o w n ' ) ) matchSelector t h i s . t r a n s i t i o n ( t h i s . m a t c h S e l e c t o r ( ' . s p a c e r ' ) , t h i s . u s e ( ' t o D o w n ' ) ) childOf t h i s . t r a n s i t i o n ( t h i s . c h i l d O f ( ' # c o n t a i n e r ' ) , t h i s . u s e ( ' t o D o w n ' ) ) inHelper t h i s . t r a n s i t i o n ( t h i s . i n H e l p e r ( ' l i q u i d - i f ' ) , t h i s . u s e ( ' t o D o w n ' ) )
  • 14. TRANSITIONS implement animation between two states, manipulate the DOM to pass from the old view's value to the new one. PREDEFINED toLeft, toRight, toDown, toUp fade, crossFade explode fly-to
  • 15. EXPLODE You can animate every single piece of the template. It accepts any number of objects as argument, and every object must have a use property. t h i s . t r a n s i t i o n ( t h i s . c h i l d O f ( ' # c o n t a i n e r ' ) , t h i s . u s e ( ' e x p l o d e ' , { p i c k N e w : ' . s p a c e r ' , u s e : ' t o D o w n ' } , { p i c k N e w : ' . b r e a d c r u m b s ' , u s e : ' t o L e f t ' } , { / / f o r a l l o t h e r e l e m e n t s u s e : ' f a d e ' } }
  • 16. CUSTOM TRANSITIONS Must be located in app/transitions/transition-name.js There are different animation primitives available i m p o r t { s t o p , a n i m a t e , P r o m i s e } f r o m " l i q u i d - f i r e " ; e x p o r t d e f a u l t f u n c t i o n r o t a t e B e l o w ( o p t s = { } ) { v a r d i r e c t i o n = 1 ; i f ( o p t s . d i r e c t i o n = = = ' c w ' ) { d i r e c t i o n = - 1 ; } s t o p ( t h i s . o l d E l e m e n t ) ; i f ( t h i s . o l d E l e m e n t ) { t h i s . o l d E l e m e n t . c s s ( ' t r a n s f o r m - o r i g i n ' , ' 5 0 % 1 5 0 % ' ) ; } i f ( t h i s . n e w E l e m e n t ) { t h i s . n e w E l e m e n t . c s s ( ' t r a n s f o r m - o r i g i n ' , ' 5 0 % 1 5 0 % ' ) ; } r e t u r n P r o m i s e . a l l ( [ a n i m a t e ( t h i s . o l d E l e m e n t , { r o t a t e Z : - 9 0 * d i r e c t i o n + ' d e g ' } , o p t s ) , a n i m a t e ( t h i s . n e w E l e m e n t , { r o t a t e Z : [ ' 0 d e g ' , 9 0 * d i r e c t i o n + ' d e g ' ] } , o p t s )
  • 17. PROBLEMS ENCOUNTERED Not all feature are available in oldStable branch overflow: hidden 'hidden' features -> liquid-animating Bug with position: fixed and chrome PR#209 Issue#197 Quick fixes . l i q u i d - c o n t a i n e r . l i q u i d - a n i m a t i n g { o v e r f l o w : h i d d e n ; } . l i q u i d - c o n t a i n e r > . l i q u i d - c h i l d , . l i q u i d - c o n t a i n e r { t r a n s f o r m : i n i t i a l ; o v e r f l o w : i n i t i a l ; }