Last active
May 29, 2019 11:55
-
-
Save iezer/d9f9d79527aa3968465aecc648bbaf25 to your computer and use it in GitHub Desktop.
Liquid Fire Demo #3 - Explode & FlyTo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
let duration = 400; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
animationRules: animationRules | |
}); | |
function animationRules() { | |
this.transition( | |
this.toValue(true), | |
this.useAndReverse('fade', { duration }) | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import config from './config/environment'; | |
const Router = Ember.Router.extend({ | |
location: 'none', | |
rootURL: config.rootURL | |
}); | |
Router.map(function() { | |
this.route('item', { path: '/:id' }); | |
}); | |
export default Router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
model() { | |
let result = []; | |
for (let i = 1; i<= 10; i++) { | |
result.push({ | |
id: i, | |
name: `Product #${i}` | |
}); | |
} | |
return result; | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.header, .footer { | |
position: fixed; | |
height: 75px; | |
width: 100%; | |
background: orange; | |
left: 0px; | |
} | |
.header { top: 0px; } | |
.footer { bottom: 0px; } | |
.application__body { | |
position: fixed; | |
width: 100%; | |
top: 75px; | |
bottom: 75px; | |
} | |
.item { | |
border: 1px solid black; | |
margin: 5px; | |
} | |
.index__scroll-container { | |
height: 100%; | |
overflow-y: scroll; | |
/* Required for momentum scrolling in iOS Safari. | |
also overflow-y has to be 'scroll' and not 'auto' | |
*/ | |
-webkit-overflow-scrolling: touch; | |
} | |
.item.focused { | |
border: 1px solid red; | |
margin: 5px; | |
} | |
.liquid-container, .liquid-child { | |
weight: 100%; | |
height: 100%; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let duration = 1000; | |
export default function(){ | |
this.transition( | |
this.fromRoute('index'), | |
this.toRoute('item'), | |
this.useAndReverse('explode', { | |
// Liquid Fire matches elements on data-item-di | |
// And will animate one to the other if the value matches. | |
matchBy: 'data-item-id', | |
use: ['flyTo', { duration } ] | |
}, { | |
// Everything that doesn't match uses crossFade | |
use: ['crossFade', { duration }] | |
}) | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.10.7", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.5.1", | |
"ember-template-compiler": "2.5.1", | |
"ember-testing": "2.5.1" | |
}, | |
"addons": { | |
"liquid-fire": "0.25.0", | |
"ember-elsewhere": "0.4.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment