From 8f27870d938e8fb241545e8fe9f71c8ea1226b62 Mon Sep 17 00:00:00 2001 From: Sergej Atamantschuk Date: Thu, 30 Apr 2020 21:17:21 +0200 Subject: [PATCH 01/43] feat: add dot basic markup --- package.json | 2 +- src/App.vue | 115 +---------------------- src/components/Circle/CircleDot.vue | 46 +++++++++ src/components/Circle/CircleProgress.vue | 4 +- 4 files changed, 54 insertions(+), 113 deletions(-) create mode 100644 src/components/Circle/CircleDot.vue diff --git a/package.json b/package.json index f9ab8a1..5ecde26 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "serve": "vue-cli-service serve", "build": "vue-cli-service build --target lib --formats umd-min --name vue-ellipse-progress ./src/plugin.js", "lint": "vue-cli-service lint --fix", - "test": "vue-cli-service test:unit -R travis-cov" + "test": "vue-cli-service test:unit" }, "dependencies": { "countup.js": "^2.0.4", diff --git a/src/App.vue b/src/App.vue index e8a6d7d..006a88a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -39,125 +39,18 @@ --> - - /hui -

This is caption slot

-
- - - - - - - - - - -
- - - -
- + + + diff --git a/src/components/Circle/CircleProgress.vue b/src/components/Circle/CircleProgress.vue index d196f4b..6d43b2f 100644 --- a/src/components/Circle/CircleProgress.vue +++ b/src/components/Circle/CircleProgress.vue @@ -46,16 +46,18 @@ :style="styles" > + @@ -34,9 +42,14 @@ export default { From b0a8f18ba0aeae7c620b0ae613bcd75b83d6e509 Mon Sep 17 00:00:00 2001 From: Sergej Atamantschuk Date: Fri, 15 May 2020 20:20:22 +0200 Subject: [PATCH 05/43] feat: add dot prop to interface --- src/App.vue | 2 +- src/components/Circle/CircleDot.vue | 14 ++++++++++++-- src/components/interface.js | 11 +++++++++++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/App.vue b/src/App.vue index 91ebcc9..7d01fd2 100644 --- a/src/App.vue +++ b/src/App.vue @@ -46,7 +46,7 @@ animation="default 1500 1000" :angle="-90" :legend="false" - :thickness="10" + :thickness="20" :empty-thickness="10" /> diff --git a/src/components/Circle/CircleDot.vue b/src/components/Circle/CircleDot.vue index 8471011..deb3417 100644 --- a/src/components/Circle/CircleDot.vue +++ b/src/components/Circle/CircleDot.vue @@ -1,5 +1,12 @@ @@ -13,6 +20,9 @@ export default { name: "CircleDot", mixins: [CircleMixin], computed: { + dotContainerPosition() { + return (this.size - (this.radius + 5) * 2) / 2; + }, dotContainerStyle() { let rotation = 0; if (this.isInitialized && !this.loading && this.dataIsAvailable) { @@ -42,7 +52,7 @@ export default { diff --git a/src/components/Circle/HalfCircleProgress.vue b/src/components/Circle/HalfCircleProgress.vue index 1cd24e1..eac0d3b 100644 --- a/src/components/Circle/HalfCircleProgress.vue +++ b/src/components/Circle/HalfCircleProgress.vue @@ -88,6 +88,4 @@ export default { .ep-half-circle--container { transform-origin: 50% 50%; } -@import "~@/styles/animations.scss"; -@import "~@/styles/animationsUsage.scss"; diff --git a/src/components/interface.js b/src/components/interface.js index bf1b9e2..239833e 100644 --- a/src/components/interface.js +++ b/src/components/interface.js @@ -83,6 +83,7 @@ const props = { validator: (value) => { const config = value.split(" "); const isValidType = ["default", "rs", "loop", "reverse", "bounce"].some((val) => val === config[0]); + // FIXME: config[1] const isValidDuration = config[0] ? parseFloat(config[1]) > 0 : true; const isValidDelay = config[2] ? parseFloat(config[2]) > 0 : true; diff --git a/src/styles/animations.scss b/src/styles/animations.scss index e8c1479..029e82a 100644 --- a/src/styles/animations.scss +++ b/src/styles/animations.scss @@ -121,3 +121,17 @@ } } } + +@mixin ep-dot--init__rs ($dotStart, $dotEnd) { + @keyframes ep-dot--init__rs { + 0% { + transform: rotate(#{$dotStart}deg); + } + 50% { + transform: rotate(#{$dotStart + 360}deg); + } + 100% { + transform: rotate(#{$dotEnd}deg); + } + } +} diff --git a/src/styles/animationsUsage.scss b/src/styles/animationsUsage.scss index 642938a..657f1af 100644 --- a/src/styles/animationsUsage.scss +++ b/src/styles/animationsUsage.scss @@ -1,22 +1,18 @@ .ep-circle--progress { + animation-timing-function: ease-in-out; &.animation__default { - animation-timing-function: ease-in-out; animation-name: ep-progress--init__default; } &.animation__rs { - animation-timing-function: ease-out; animation-name: ep-progress--init__rs; } &.animation__bounce { - animation-timing-function: ease-out; animation-name: ep-progress--init__bounce; } &.animation__reverse { - animation-timing-function: ease-out; animation-name: ep-progress--init__reverse; } &.animation__loop { - animation-timing-function: ease-out; animation-name: ep-progress--init__loop; } } @@ -45,6 +41,20 @@ } } +.ep-circle--progress__dot-container { + animation-duration: 2s !important; + animation-timing-function: ease-in-out; + &.animation__rs { + animation-name: ep-dot--init__rs; + } + &.animation__bounce { + } + &.animation__reverse { + } + &.animation__loop { + } +} + @include ep-progress--init__default(var(--ep-stroke-offset), var(--ep-circumference)); @include ep-progress--init__rs(var(--ep-stroke-offset), var(--ep-circumference)); @include ep-progress--init__bounce( @@ -67,3 +77,4 @@ @include ep-half-progress--loading(var(--ep-loading-stroke-offset), var(--ep-circumference), var(--ep-negative-circumference)); @include ep-progress--loading__rotation(); +@include ep-dot--init__rs(var(--ep-dot-start), var(--ep-dot-end)); From 7e26deafbc5c96a1bb4ce4cf2711e83526ed6624 Mon Sep 17 00:00:00 2001 From: Sergej Atamantschuk Date: Sun, 17 May 2020 12:53:31 +0200 Subject: [PATCH 20/43] feat: add dot rs animation --- src/App.vue | 4 ++-- src/components/Circle/CircleDot.vue | 5 +++-- src/styles/animations.scss | 8 ++++---- src/styles/animationsUsage.scss | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/App.vue b/src/App.vue index 84bc5d6..ab31ee7 100644 --- a/src/App.vue +++ b/src/App.vue @@ -48,8 +48,8 @@ :legend="false" :thickness="10" :empty-thickness="4" - animation="rs" - :dot="{ size: 10, backgroundColor: 'rgba(123,256,200,0.5)' }" + animation="rs 2000" + :dot="{ size: 20, backgroundColor: 'rgba(4,256,4,1)' }" line-mode="normal" /> diff --git a/src/components/Circle/CircleDot.vue b/src/components/Circle/CircleDot.vue index 8098f0a..8f51f9f 100644 --- a/src/components/Circle/CircleDot.vue +++ b/src/components/Circle/CircleDot.vue @@ -40,8 +40,9 @@ export default { transitionDuration: this.loading ? "0s" : this.animationDuration, transitionTimingFunction: "ease-in-out", "--ep-dot-size": this.dotSize, - "--ep-dot-start": this.dotStart, - "--ep-dot-end": this.dotEnd, + "--ep-dot-start": `${this.dotStart}deg`, + "--ep-dot-360": `${this.dotStart + 360}deg`, + "--ep-dot-end": `${this.dotEnd}deg`, }; }, dotStyle() { diff --git a/src/styles/animations.scss b/src/styles/animations.scss index 029e82a..a56de13 100644 --- a/src/styles/animations.scss +++ b/src/styles/animations.scss @@ -122,16 +122,16 @@ } } -@mixin ep-dot--init__rs ($dotStart, $dotEnd) { +@mixin ep-dot--init__rs ($dotStart, $dotEnd, $dot360) { @keyframes ep-dot--init__rs { 0% { - transform: rotate(#{$dotStart}deg); + transform: rotate($dotStart); } 50% { - transform: rotate(#{$dotStart + 360}deg); + transform: rotate($dot360); } 100% { - transform: rotate(#{$dotEnd}deg); + transform: rotate($dotEnd); } } } diff --git a/src/styles/animationsUsage.scss b/src/styles/animationsUsage.scss index 657f1af..89d8e1d 100644 --- a/src/styles/animationsUsage.scss +++ b/src/styles/animationsUsage.scss @@ -77,4 +77,4 @@ @include ep-half-progress--loading(var(--ep-loading-stroke-offset), var(--ep-circumference), var(--ep-negative-circumference)); @include ep-progress--loading__rotation(); -@include ep-dot--init__rs(var(--ep-dot-start), var(--ep-dot-end)); +@include ep-dot--init__rs(var(--ep-dot-start), var(--ep-dot-end), var(--ep-dot-360)); From 42c0adf3295330fc1e89769c81c3ec63aac06cee Mon Sep 17 00:00:00 2001 From: Sergej Atamantschuk Date: Sun, 17 May 2020 13:13:54 +0200 Subject: [PATCH 21/43] feat: add dot loop animation --- src/App.vue | 2 +- src/components/Circle/CircleDot.vue | 14 +++++++++++++- src/styles/animations.scss | 15 +++++++++++++++ src/styles/animationsUsage.scss | 1 + 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/App.vue b/src/App.vue index ab31ee7..2bf18e1 100644 --- a/src/App.vue +++ b/src/App.vue @@ -48,7 +48,7 @@ :legend="false" :thickness="10" :empty-thickness="4" - animation="rs 2000" + animation="loop 2000" :dot="{ size: 20, backgroundColor: 'rgba(4,256,4,1)' }" line-mode="normal" /> diff --git a/src/components/Circle/CircleDot.vue b/src/components/Circle/CircleDot.vue index 8f51f9f..67d311b 100644 --- a/src/components/Circle/CircleDot.vue +++ b/src/components/Circle/CircleDot.vue @@ -41,10 +41,22 @@ export default { transitionTimingFunction: "ease-in-out", "--ep-dot-size": this.dotSize, "--ep-dot-start": `${this.dotStart}deg`, - "--ep-dot-360": `${this.dotStart + 360}deg`, "--ep-dot-end": `${this.dotEnd}deg`, + ...this.dotContainerAnimationStyle, }; }, + dotContainerAnimationStyle() { + const styles = { + rs: { + "--ep-dot-360": `${this.dotStart + 360}deg`, + }, + loop: { + "--ep-dot-360": `${this.dotStart + 360}deg`, + "--ep-dot-loop-end": `${this.dotStart + 360 + this.dotEnd}deg`, + }, + }; + return styles[this.parsedAnimation.type]; + }, dotStyle() { return { borderRadius: `${this.dotSize / 2}px`, diff --git a/src/styles/animations.scss b/src/styles/animations.scss index a56de13..d2e8fe4 100644 --- a/src/styles/animations.scss +++ b/src/styles/animations.scss @@ -135,3 +135,18 @@ } } } + +@keyframes ep-dot--init__loop { + 0% { + transform: rotate(var(--ep-dot-start)); + } + 33% { + transform: rotate(var(--ep-dot-360)); + } + 66% { + transform: rotate(var(--ep-dot-360)); + } + 100% { + transform: rotate(var(--ep-dot-loop-end)); + } +} diff --git a/src/styles/animationsUsage.scss b/src/styles/animationsUsage.scss index 89d8e1d..aa94f8f 100644 --- a/src/styles/animationsUsage.scss +++ b/src/styles/animationsUsage.scss @@ -52,6 +52,7 @@ &.animation__reverse { } &.animation__loop { + animation-name: ep-dot--init__loop; } } From 6fb1586bbe3af8041b275d520697a97156b131a4 Mon Sep 17 00:00:00 2001 From: Sergej Atamantschuk Date: Sun, 17 May 2020 13:18:14 +0200 Subject: [PATCH 22/43] feat: add dot reverse animation --- src/App.vue | 2 +- src/components/Circle/CircleDot.vue | 5 +---- src/styles/animations.scss | 12 ++++++++++++ src/styles/animationsUsage.scss | 1 + 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/App.vue b/src/App.vue index 2bf18e1..4f9aae4 100644 --- a/src/App.vue +++ b/src/App.vue @@ -48,7 +48,7 @@ :legend="false" :thickness="10" :empty-thickness="4" - animation="loop 2000" + animation="reverse 2000" :dot="{ size: 20, backgroundColor: 'rgba(4,256,4,1)' }" line-mode="normal" /> diff --git a/src/components/Circle/CircleDot.vue b/src/components/Circle/CircleDot.vue index 67d311b..74f37e7 100644 --- a/src/components/Circle/CircleDot.vue +++ b/src/components/Circle/CircleDot.vue @@ -42,16 +42,13 @@ export default { "--ep-dot-size": this.dotSize, "--ep-dot-start": `${this.dotStart}deg`, "--ep-dot-end": `${this.dotEnd}deg`, + "--ep-dot-360": `${this.dotStart + 360}deg`, ...this.dotContainerAnimationStyle, }; }, dotContainerAnimationStyle() { const styles = { - rs: { - "--ep-dot-360": `${this.dotStart + 360}deg`, - }, loop: { - "--ep-dot-360": `${this.dotStart + 360}deg`, "--ep-dot-loop-end": `${this.dotStart + 360 + this.dotEnd}deg`, }, }; diff --git a/src/styles/animations.scss b/src/styles/animations.scss index d2e8fe4..103f9f9 100644 --- a/src/styles/animations.scss +++ b/src/styles/animations.scss @@ -150,3 +150,15 @@ transform: rotate(var(--ep-dot-loop-end)); } } + +@keyframes ep-dot--init__reverse { + 0% { + transform: rotate(var(--ep-dot-360)); + } + 50% { + transform: rotate(var(--ep-dot-360)); + } + 100% { + transform: rotate(var(--ep-dot-end)); + } +} diff --git a/src/styles/animationsUsage.scss b/src/styles/animationsUsage.scss index aa94f8f..0899fef 100644 --- a/src/styles/animationsUsage.scss +++ b/src/styles/animationsUsage.scss @@ -50,6 +50,7 @@ &.animation__bounce { } &.animation__reverse { + animation-name: ep-dot--init__reverse; } &.animation__loop { animation-name: ep-dot--init__loop; From fd502a8d6ffc4768cd293907bf02d622d901a542 Mon Sep 17 00:00:00 2001 From: Sergej Atamantschuk Date: Sun, 17 May 2020 13:57:47 +0200 Subject: [PATCH 23/43] feat: add dot bounce animation handling --- src/App.vue | 16 +++++++++++++++- src/components/Circle/CircleDot.vue | 5 +++++ src/styles/animations.scss | 12 ++++++++++++ src/styles/animationsUsage.scss | 3 ++- 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/App.vue b/src/App.vue index 4f9aae4..8be13f2 100644 --- a/src/App.vue +++ b/src/App.vue @@ -48,11 +48,25 @@ :legend="false" :thickness="10" :empty-thickness="4" - animation="reverse 2000" + animation="bounce 5000" :dot="{ size: 20, backgroundColor: 'rgba(4,256,4,1)' }" line-mode="normal" /> + diff --git a/src/components/Circle/CircleDot.vue b/src/components/Circle/CircleDot.vue index 74f37e7..024f406 100644 --- a/src/components/Circle/CircleDot.vue +++ b/src/components/Circle/CircleDot.vue @@ -39,6 +39,7 @@ export default { transform: `rotate(${this.dotContainerRotation}deg)`, transitionDuration: this.loading ? "0s" : this.animationDuration, transitionTimingFunction: "ease-in-out", + "animation-duration": this.animationDuration, "--ep-dot-size": this.dotSize, "--ep-dot-start": `${this.dotStart}deg`, "--ep-dot-end": `${this.dotEnd}deg`, @@ -51,6 +52,10 @@ export default { loop: { "--ep-dot-loop-end": `${this.dotStart + 360 + this.dotEnd}deg`, }, + bounce: { + opacity: 0, + "animation-duration": `${this.parsedAnimation.duration + 500}ms`, + }, }; return styles[this.parsedAnimation.type]; }, diff --git a/src/styles/animations.scss b/src/styles/animations.scss index 103f9f9..22de3fe 100644 --- a/src/styles/animations.scss +++ b/src/styles/animations.scss @@ -162,3 +162,15 @@ transform: rotate(var(--ep-dot-end)); } } + +@keyframes ep-dot--init__bounce { + 0% { + opacity: 0; + } + 90% { + opacity: 0; + } + 100% { + opacity: 1; + } +} diff --git a/src/styles/animationsUsage.scss b/src/styles/animationsUsage.scss index 0899fef..f45c577 100644 --- a/src/styles/animationsUsage.scss +++ b/src/styles/animationsUsage.scss @@ -42,12 +42,13 @@ } .ep-circle--progress__dot-container { - animation-duration: 2s !important; animation-timing-function: ease-in-out; &.animation__rs { animation-name: ep-dot--init__rs; } &.animation__bounce { + opacity: 1 !important; + animation-name: ep-dot--init__bounce; } &.animation__reverse { animation-name: ep-dot--init__reverse; From f5464f6bd9851ed7102f5d3e64ecbea045f2e2b5 Mon Sep 17 00:00:00 2001 From: Sergej Atamantschuk Date: Tue, 19 May 2020 18:01:19 +0200 Subject: [PATCH 24/43] feat: adjust dot for half circle --- src/App.vue | 11 ++++++----- src/components/Circle/CircleDot.vue | 27 +++++++++++++++------------ src/styles/animations.scss | 12 ++++++++++++ src/styles/animationsUsage.scss | 12 +++++++++++- 4 files changed, 44 insertions(+), 18 deletions(-) diff --git a/src/App.vue b/src/App.vue index 8be13f2..3766c87 100644 --- a/src/App.vue +++ b/src/App.vue @@ -44,12 +44,13 @@ :loading="loading" :no-data="noData" :progress="progress" - :angle="-90" - :legend="false" + :angle="190" + :legend="true" :thickness="10" + :animation="animation" :empty-thickness="4" - animation="bounce 5000" - :dot="{ size: 20, backgroundColor: 'rgba(4,256,4,1)' }" + half + :dot="{ size: 20 }" line-mode="normal" /> @@ -138,7 +139,7 @@ export default { ], radial: true, }, - animation: "rs 200 5000", + animation: "rs 1000 500", }), computed: { tasksDonePercent() { diff --git a/src/components/Circle/CircleDot.vue b/src/components/Circle/CircleDot.vue index 024f406..429ffef 100644 --- a/src/components/Circle/CircleDot.vue +++ b/src/components/Circle/CircleDot.vue @@ -3,7 +3,7 @@ :x="dotContainerPosition" :y="dotContainerPosition" class="ep-circle--progress__dot-container" - :class="animationClass" + :class="dotContainerClasses" :width="dotContainerSize" :height="dotContainerSize" :style="dotContainerStyle" @@ -28,11 +28,13 @@ export default { return this.radius * 2 + this.dotSize; }, dotContainerRotation() { - let rotation = this.angle + 90; if (this.isInitialized && !this.loading && this.dataIsAvailable) { - rotation += (this.computedProgress * 360) / 100; + return this.dotEnd; } - return rotation; + return this.dotStart; + }, + dotContainerFullRotationDeg() { + return this.half ? 180 : 360; }, dotContainerStyle() { return { @@ -40,17 +42,20 @@ export default { transitionDuration: this.loading ? "0s" : this.animationDuration, transitionTimingFunction: "ease-in-out", "animation-duration": this.animationDuration, - "--ep-dot-size": this.dotSize, "--ep-dot-start": `${this.dotStart}deg`, "--ep-dot-end": `${this.dotEnd}deg`, - "--ep-dot-360": `${this.dotStart + 360}deg`, + "--ep-dot-360": `${this.dotStart + this.dotContainerFullRotationDeg}deg`, ...this.dotContainerAnimationStyle, }; }, + dotContainerClasses() { + return [this.animationClass, !this.half || "ep-half-circle-progress__dot"]; + }, dotContainerAnimationStyle() { const styles = { loop: { - "--ep-dot-loop-end": `${this.dotStart + 360 + this.dotEnd}deg`, + opacity: this.half ? 0 : 1, + "--ep-dot-loop-end": `${this.dotStart + this.dotContainerFullRotationDeg + this.dotEnd}deg`, }, bounce: { opacity: 0, @@ -70,10 +75,10 @@ export default { }; }, dotStart() { - return this.angle + 90; + return this.half ? this.angle - 90 : this.angle + 90; }, dotEnd() { - return this.dotStart + (this.computedProgress * 360) / 100; + return this.dotStart + (this.computedProgress * this.dotContainerFullRotationDeg) / 100; }, isHidden() { return this.loading || !this.dataIsAvailable; @@ -84,7 +89,7 @@ export default {