git ssb

0+

alanz / patchwork



forked from Matt McKegg / patchwork

Commit df5f8b10e8ff479e6762ae7762c99ecf5e92bccf

add slight animation to peer progress

Matt McKegg committed on 3/14/2017, 9:52:55 AM
Parent: 1e749ac35548ddbe1f4662e9cfc2afadcfe9a2cf

Files changed

modules/progress/html/render.jschanged
modules/progress/html/render.jsView
@@ -1,12 +1,14 @@
11 var svg = require('mutant/svg-element')
22 var computed = require('mutant/computed')
3+var when = require('mutant/when')
34 var nest = require('depnest')
45
56 exports.gives = nest('progress.html.render')
67
78 exports.create = function (api) {
89 return nest('progress.html.render', function (pos, classList) {
10+ var pending = computed(pos, x => x > 0 && x < 1)
911 return svg('svg RadialProgress', {
1012 viewBox: '-20 -20 240 240',
1113 classList
1214 }, [
@@ -21,8 +23,11 @@
2123 'stroke-dashoffset': computed(pos, (pos) => {
2224 pos = Math.min(Math.max(pos, 0), 1)
2325 return (1 - pos) * 629
2426 }),
27+ 'style': {
28+ transition: when(pending, 'stroke-dashoffset 0.1s', 'stroke-dashoffset 0')
29+ },
2530 'stroke-width': 40,
2631 'stroke-dasharray': 629,
2732 'stroke': '#33DA33',
2833 'fill': 'none'

Built with git-ssb-web