|
@@ -1,14 +1,23 @@
|
|
const html = require('yo-yo')
|
|
const html = require('yo-yo')
|
|
|
|
|
|
// http://codepen.io/Harkko/pen/rVxvNM
|
|
// http://codepen.io/Harkko/pen/rVxvNM
|
|
|
|
+// https://css-tricks.com/svg-line-animation-works/
|
|
// https://gist.github.com/eswak/ad4ea57bcd5ff7aa5d42
|
|
// https://gist.github.com/eswak/ad4ea57bcd5ff7aa5d42
|
|
|
|
|
|
|
|
+// circle length equals 2 * PI * R
|
|
|
|
+const circleLength = 2 * Math.PI * 15
|
|
|
|
+
|
|
|
|
+// stroke-dashoffset is a percentage of the progress from circleLength,
|
|
|
|
+// substracted from circleLength, because its an offset
|
|
module.exports = (props) => {
|
|
module.exports = (props) => {
|
|
return html`
|
|
return html`
|
|
<svg width="70" height="70" viewBox="0 0 36 36" class="UppyIcon UppyIcon-progressCircle">
|
|
<svg width="70" height="70" viewBox="0 0 36 36" class="UppyIcon UppyIcon-progressCircle">
|
|
<g class="progress-group">
|
|
<g class="progress-group">
|
|
<circle r="15" cx="18" cy="18" stroke-width="2" fill="none" class="bg"/>
|
|
<circle r="15" cx="18" cy="18" stroke-width="2" fill="none" class="bg"/>
|
|
- <circle r="15" cx="18" cy="18" transform="rotate(-90, 18, 18)" stroke-width="2" fill="none" stroke-dasharray="100" stroke-dashoffset="${100 - props.progress}" class="progress"/>
|
|
|
|
|
|
+ <circle r="15" cx="18" cy="18" transform="rotate(-90, 18, 18)" stroke-width="2" fill="none" class="progress"
|
|
|
|
+ stroke-dasharray=${circleLength}
|
|
|
|
+ stroke-dashoffset=${circleLength - (circleLength / 100 * props.progress)}
|
|
|
|
+ />
|
|
</g>
|
|
</g>
|
|
<polygon transform="translate(3, 3)" points="12 20 12 10 20 15" class="play"/>
|
|
<polygon transform="translate(3, 3)" points="12 20 12 10 20 15" class="play"/>
|
|
<g transform="translate(14.5, 13)" class="pause">
|
|
<g transform="translate(14.5, 13)" class="pause">
|