Last active
April 5, 2018 19:58
-
-
Save brettburley/6af9da221e5d3014f43377a0d13ac210 to your computer and use it in GitHub Desktop.
sample animations
This file contains hidden or 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.Component.extend({ | |
| classNames: ['liquidfire-transition'], | |
| isTransitioned: false, | |
| click() { | |
| this._super(); | |
| this.toggleProperty('isTransitioned'); | |
| } | |
| }); |
This file contains hidden or 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.Component.extend({ | |
| classNames: ['manual-transition'], | |
| isTransitioned: false, | |
| firstPaneIsActive: true, | |
| secondPaneIsActive: false, | |
| firstPaneIsTransitioningIn: false, | |
| firstPaneIsTransitioningOut: false, | |
| secondPaneIsTransitioningIn: false, | |
| secondPaneIsTransitioningOut: false, | |
| click() { | |
| this._super(); | |
| this.toggleProperty('isTransitioned'); | |
| this.animateTransition(); | |
| }, | |
| animateTransition() { | |
| if (this.get('isTransitioned')) { | |
| this.setProperties({ | |
| firstPaneIsTransitioningOut: true, | |
| secondPaneIsActive: true, | |
| secondPaneIsTransitioningIn: true | |
| }); | |
| Ember.run.later(() => { | |
| this.setProperties({ | |
| firstPaneIsActive: false, | |
| firstPaneIsTransitioningOut: false, | |
| secondPaneIsTransitioningIn: false | |
| }); | |
| }, 1000); | |
| } else { | |
| this.setProperties({ | |
| secondPaneIsTransitioningOut: true, | |
| firstPaneIsActive: true, | |
| firstPaneIsTransitioningIn: true | |
| }); | |
| Ember.run.later(() => { | |
| this.setProperties({ | |
| secondPaneIsActive: false, | |
| secondPaneIsTransitioningOut: false, | |
| firstPaneIsTransitioningIn: false | |
| }); | |
| }, 1000); | |
| } | |
| } | |
| }); |
This file contains hidden or 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.Component.extend({ | |
| classNames: ['pane'], | |
| classNameBindings: [ | |
| 'isTransitioningIn:pane--is-transitioning-in', | |
| 'isTransitioningOut:pane--is-transitioning-out' | |
| ] | |
| }); |
This file contains hidden or 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.Component.extend({ | |
| classNames: ['pane'], | |
| classNameBindings: [ | |
| 'isTransitioningIn:pane--is-transitioning-in', | |
| 'isTransitioningOut:pane--is-transitioning-out' | |
| ], | |
| actions: { | |
| refresh() { | |
| alert('Refreshing!'); | |
| } | |
| } | |
| }); |
This file contains hidden or 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.Component.extend({ | |
| classNames: ['simple-transition'], | |
| isTransitioned: false, | |
| click() { | |
| this._super(); | |
| this.toggleProperty('isTransitioned'); | |
| } | |
| }); |
This file contains hidden or 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.Controller.extend({ | |
| appName: 'Ember Twiddle' | |
| }); |
This file contains hidden or 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
| /* PANE */ | |
| .pane { | |
| border: 1px solid #ccc; | |
| flex: 1; | |
| overflow: hidden; | |
| height: 200px; | |
| display: flex; | |
| flex-direction: column; | |
| } | |
| .pane--is-transitioning-in { | |
| position: absolute; | |
| top: 0; | |
| width: 100%; | |
| border: 0; | |
| } | |
| .pane__header { | |
| border-bottom: 1px solid #ccc; | |
| padding: 20px; | |
| opacity: 1; | |
| font-weight: bold; | |
| } | |
| .pane--is-transitioning-in .pane__header, | |
| .pane--is-transitioning-out .pane__header { | |
| opacity: 0; | |
| } | |
| .pane__header-action { | |
| color: blue; | |
| float: right; | |
| } | |
| .pane__body { | |
| padding: 20px; | |
| flex: 1; | |
| } | |
| .pane--is-transitioning-in .pane__body { | |
| transform: translate3d(100%, 0, 0); | |
| transition: 1s ease-out; | |
| } | |
| .pane--is-transitioning-out .pane__body { | |
| transform: translate3d(-100%, 0, 0); | |
| transition: 1s ease-in; | |
| } | |
| .pane__footer { | |
| padding: 20px; | |
| background-color: blue; | |
| color: white; | |
| } | |
| .pane--is-transitioning-in .pane__footer, | |
| .pane--is-transitioning-out .pane__footer { | |
| transform: translate3d(0, 100%, 0); | |
| } | |
| /* SIMPLE TRANSITION */ | |
| .simple-transition { | |
| width: 100%; | |
| overflow: hidden; | |
| } | |
| .simple-transition__stage { | |
| display: flex; | |
| width: 200%; | |
| transition: all 1s; | |
| } | |
| .simple-transition__stage--is-transitioned { | |
| transform: translate3d(-50%, 0, 0); | |
| } | |
| /* MANUAL TRANSITION */ | |
| .manual-transition { | |
| position: relative; | |
| } | |
| .manual-transition .pane__header { | |
| transition: 1s all; | |
| } | |
| .manual-transition .pane__body { | |
| transition: 1s all; | |
| } | |
| .manual-transition .pane__footer { | |
| transition: 1s all; | |
| } |
This file contains hidden or 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
| export default function() { | |
| this.transition( | |
| this.childOf('.liquidfire-transition'), | |
| this.use('explode', { | |
| pick: '.pane__header', | |
| use: ['crossFade', { duration: 1000 }] | |
| }, { | |
| pick: '.pane__body', | |
| use: ['toLeft', { duration: 1000 }] | |
| }, { | |
| pickOld: '.pane__footer', | |
| use: ['toDown', { duration: 1000 }] | |
| }, { | |
| pickNew: '.pane__footer', | |
| use: ['toUp', { duration: 1000 }] | |
| }) | |
| ); | |
| } |
This file contains hidden or 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.13.1", | |
| "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.16.2", | |
| "ember-template-compiler": "2.16.2", | |
| "ember-testing": "2.16.2" | |
| }, | |
| "addons": { | |
| "ember-data": "2.16.3", | |
| "liquid-fire": "0.29.2" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment