Files: 6b5fb10bffe7df13233ba65f8a3631d6121ed3cd / modules / progress / html / render.js
844 bytesRaw
1 | var svg = require('mutant/svg-element') |
2 | var computed = require('mutant/computed') |
3 | var nest = require('depnest') |
4 | |
5 | exports.gives = nest('progress.html.render') |
6 | |
7 | exports.create = function (api) { |
8 | return nest('progress.html.render', function (pos) { |
9 | return svg('svg RadialProgress', { |
10 | viewBox: '-20 -20 240 240' |
11 | }, [ |
12 | svg('path', { |
13 | d: 'M100,0 a100,100 0 0 1 0,200 a100,100 0 0 1 0,-200,0', |
14 | 'stroke': '#DADADA', |
15 | 'fill': 'none' |
16 | }), |
17 | svg('path', { |
18 | d: 'M100,0 a100,100 0 0 1 0,200 a100,100 0 0 1 0,-200,0', |
19 | 'stroke-dashoffset': computed(pos, (pos) => { |
20 | pos = Math.min(Math.max(pos, 0), 1) |
21 | return (1 - pos) * 629 |
22 | }), |
23 | 'stroke-width': 40, |
24 | 'stroke-dasharray': 629, |
25 | 'stroke': '#33DA33', |
26 | 'fill': 'none' |
27 | }) |
28 | ]) |
29 | }) |
30 | } |
31 |
Built with git-ssb-web