Skip to content

Commit 81087e1

Browse files
committed
Improvement - VueUiDonut - Improve serie segregating animation timing
1 parent ec37dba commit 81087e1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/components/vue-ui-donut.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ function segregate(index) {
244244
const target = immutableSet.value.find((_, idx) => idx === index)
245245
const source = mutableSet.value.find((_, idx) => idx === index)
246246
let initVal = source.value;
247+
let incr = 1;
247248
if(segregated.value.includes(index)) {
248249
segregated.value = segregated.value.filter(s => s !== index);
249250
const targetVal = target.value;
@@ -280,7 +281,7 @@ function segregate(index) {
280281
animUp()
281282
} else if (segregated.value.length < immutableSet.value.length - 1) {
282283
function animDown() {
283-
if(initVal < 0.1) {
284+
if(initVal < source.value / 100) {
284285
cancelAnimationFrame(rafDown.value);
285286
segregated.value.push(index);
286287
mutableSet.value = mutableSet.value.map((ds, i) => {
@@ -296,7 +297,8 @@ function segregate(index) {
296297
isAnimating.value = false;
297298
} else {
298299
isAnimating.value = true;
299-
initVal /= 1.1;
300+
initVal /= (1.1 * incr);
301+
incr += 0.01;
300302
mutableSet.value = mutableSet.value.map((ds, i) => {
301303
if(index === i) {
302304
return {

0 commit comments

Comments
 (0)