Last active
August 19, 2017 19:42
-
-
Save cafreeman/0ff9bccb4d933c5e54fa527edfadf41c to your computer and use it in GitHub Desktop.
SVG
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.Component.extend({ | |
}); |
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.Component.extend({ | |
tagName: 'svg', | |
classNames: ['circle'], | |
attributeBindings: ['width:size', 'height:size', 'viewBox'], | |
viewBox: '0 0 120 120', | |
// Circle props | |
size: 120, | |
progress: null, | |
center: Ember.computed('size', function() { | |
return this.get('size') / 2; | |
}), | |
strokeWidth: Ember.computed('size', function() { | |
return this.get('size') * 0.1; | |
}), | |
radius: Ember.computed('size', 'strokeWidth', function() { | |
const { size, strokeWidth } = this.getProperties('size', 'strokeWidth'); | |
return (size / 2) - (strokeWidth / 2); | |
}), | |
circumference: Ember.computed('radius', function() { | |
return 2 * Math.PI * this.get('radius'); | |
}), | |
offset: Ember.computed('progress', 'circumference', function () { | |
const { progress, circumference } = this; | |
return ((100 - progress) / 100) * circumference; | |
}), | |
dashStyle: Ember.computed('offset', function() { | |
return Ember.String.htmlSafe(`strokeDashoffset: ${this.get('offset')}`); | |
}) | |
}); |
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' | |
}); |
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
.circle { | |
transform: rotate(-90deg); | |
fill: none; | |
stroke-linecap: round; | |
} | |
.circle .circle__background { | |
stroke: #e6e6e6; | |
} | |
.circle .circle__fill { | |
stroke: #65c3de; | |
} | |
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.12.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.12.0", | |
"ember-template-compiler": "2.12.0", | |
"ember-testing": "2.12.0" | |
}, | |
"addons": { | |
"ember-data": "2.12.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment