Skip to content

Instantly share code, notes, and snippets.

@jayjayjpg
Last active August 29, 2015 14:25
Show Gist options
  • Save jayjayjpg/6c172295ea8584a56b76 to your computer and use it in GitHub Desktop.
Save jayjayjpg/6c172295ea8584a56b76 to your computer and use it in GitHub Desktop.
Ghosttyper in Ember
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
export default Ember.Controller.extend({
init: function(){
this._super();
var code = this.get('model.cnt',0);
Ember.run.later(code.chooseLetter, 500);
},
code: Ember.computed.alias('model.cnt',0),
growingCode: '',
chooseLetter: function(){
this.set('growingCode', this.substring(0,3));
}
});
import Ember from 'ember';
var Router = Ember.Router.extend({
location: 'none'
});
Router.map(function() {
this.route('foo', {path: '/'});
});
export default Router;
export default Ember.Route.extend({
model:function() {
return [{
id: 1,
name: 'texttemplate',
cnt: 'Who are you?'
}];
}
});
export default Ember.Route.extend({
model: return
{id: 1,
name: 'texttemplate',
content: 'Who are you?'
}
});
body {
color: #00ff66;
background-color: #222;
font-family: monospace, Arial, sans-serif;
font-weight: bold;
font-size: 18px;
}
p{
-webkit-transition: all 2s ease-out;
-moz-tranistion: all 2s ease-out;
-o-transition: all 2s ease-out;
transition: all 2s ease-out;
}
@keyframes blink{
0%{opacity: 0;}
30%{opacity: 1;}
}
.cursor{
-webkit-animation: blink .9s ease-out 0s infinite normal
-moz-animation: blink .9s ease-out 0s infinite normal
-o-animation: blink .9s ease-out 0s infinite normal;
animation: blink .9s ease-out 0s infinite normal;
}
{{#each model as |code|}}
<p class="coding-block">{{growingCode}}<span class="cursor">|</span></p>
{{/each}}
<p>hi</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment