Commit df5f8b10e8ff479e6762ae7762c99ecf5e92bccf
add slight animation to peer progress
Matt McKegg committed on 3/14/2017, 9:52:55 AMParent: 1e749ac35548ddbe1f4662e9cfc2afadcfe9a2cf
Files changed
modules/progress/html/render.js | changed |
modules/progress/html/render.js | ||
---|---|---|
@@ -1,12 +1,14 @@ | ||
1 | 1 | var svg = require('mutant/svg-element') |
2 | 2 | var computed = require('mutant/computed') |
3 | +var when = require('mutant/when') | |
3 | 4 | var nest = require('depnest') |
4 | 5 | |
5 | 6 | exports.gives = nest('progress.html.render') |
6 | 7 | |
7 | 8 | exports.create = function (api) { |
8 | 9 | return nest('progress.html.render', function (pos, classList) { |
10 | + var pending = computed(pos, x => x > 0 && x < 1) | |
9 | 11 | return svg('svg RadialProgress', { |
10 | 12 | viewBox: '-20 -20 240 240', |
11 | 13 | classList |
12 | 14 | }, [ |
@@ -21,8 +23,11 @@ | ||
21 | 23 | 'stroke-dashoffset': computed(pos, (pos) => { |
22 | 24 | pos = Math.min(Math.max(pos, 0), 1) |
23 | 25 | return (1 - pos) * 629 |
24 | 26 | }), |
27 | + 'style': { | |
28 | + transition: when(pending, 'stroke-dashoffset 0.1s', 'stroke-dashoffset 0') | |
29 | + }, | |
25 | 30 | 'stroke-width': 40, |
26 | 31 | 'stroke-dasharray': 629, |
27 | 32 | 'stroke': '#33DA33', |
28 | 33 | 'fill': 'none' |
Built with git-ssb-web