Last active
October 3, 2016 01:55
-
-
Save tehmaestro/0dcbef3316252a48d4129b9902f28478 to your computer and use it in GitHub Desktop.
My twiddle
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.Controller.extend({ | |
appName: 'Ember Twiddle', | |
items: [], | |
i: 1, | |
isAnimating: false, | |
actions: { | |
addItem: function() { | |
this.get('items').pushObject({id: this.get('i')}); | |
Ember.run.next(this, this.animate); | |
} | |
}, | |
animate: function() { | |
var self = this; | |
this.set('isAnimating', true); | |
let $item = Ember.$('#image-' + this.get('i')); | |
Ember.$.Velocity($item, { | |
translateX: ["0px", "50px"], | |
opacity: 1 | |
}).then(function() { | |
self.incrementProperty('i'); | |
self.set('isAnimating', false); | |
}); | |
} | |
}); |
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 function myHelper([item]/*, hash*/) { | |
return Ember.String.htmlSafe('<div id="image-'+ item.id +'" class="image"></div>'); | |
} | |
export default Ember.Helper.helper(myHelper); |
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
body { | |
margin: 12px 16px; | |
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
font-size: 12pt; | |
} | |
.image { | |
width: 30px; | |
height: 30px; | |
background-image: url("https://cdnjs.cloudflare.com/ajax/libs/emojione/2.2.5/assets/png/1f603.png"); | |
background-size: 100% 100%; | |
display: inline-block; | |
opacity: 0; | |
} |
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.5", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "1.13.13", | |
"ember-data": "1.13.15", | |
"ember-template-compiler": "1.13.13", | |
"ember-testing": "1.13.13" | |
}, | |
"addons": { | |
"liquid-fire": "0.23.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment