add dur config

This commit is contained in:
jiaming743 2020-09-09 17:13:02 +08:00
parent 840fd8ef9c
commit 40f22d3eae
3 changed files with 19 additions and 7 deletions

View File

@ -6,7 +6,7 @@
:attributeName="reverse ? 'height' : 'width'" :attributeName="reverse ? 'height' : 'width'"
from="0" from="0"
:to="reverse ? height : width" :to="reverse ? height : width"
dur="6s" :dur="`${dur}s`"
calcMode="spline" calcMode="spline"
keyTimes="0;1" keyTimes="0;1"
keySplines=".42,0,.58,1" keySplines=".42,0,.58,1"
@ -19,7 +19,7 @@
:attributeName="reverse ? 'y' : 'x'" :attributeName="reverse ? 'y' : 'x'"
from="0" from="0"
:to="reverse ? height : width" :to="reverse ? height : width"
dur="6s" :dur="`${dur}s`"
calcMode="spline" calcMode="spline"
keyTimes="0;1" keyTimes="0;1"
keySplines="0.42,0,0.58,1" keySplines="0.42,0,0.58,1"
@ -48,6 +48,10 @@ export default {
reverse: { reverse: {
type: Boolean, type: Boolean,
default: false default: false
},
dur: {
type: Number,
default: 6
} }
}, },
data () { data () {

View File

@ -2,7 +2,7 @@
<div class="dv-decoration-4" :ref="ref"> <div class="dv-decoration-4" :ref="ref">
<div <div
:class="`container ${reverse ? 'reverse' : 'normal'}`" :class="`container ${reverse ? 'reverse' : 'normal'}`"
:style="reverse ? `width:${width}px;height:5px` : `width:5px;height:${height}px;`" :style="reverse ? `width:${width}px;height:5px;animation-duration:${dur}s` : `width:5px;height:${height}px;animation-duration:${dur}s`"
> >
<svg :width="reverse ? width : 5" :height="reverse ? 5 : height"> <svg :width="reverse ? width : 5" :height="reverse ? 5 : height">
<polyline <polyline
@ -40,6 +40,10 @@ export default {
reverse: { reverse: {
type: Boolean, type: Boolean,
default: false default: false
},
dur: {
type: Number,
default: 3
} }
}, },
data () { data () {
@ -87,13 +91,13 @@ export default {
} }
.normal { .normal {
animation: ani-height 3s ease-in-out infinite; animation: ani-height ease-in-out infinite;
left: 50%; left: 50%;
margin-left: -2px; margin-left: -2px;
} }
.reverse { .reverse {
animation: ani-width 3s ease-in-out infinite; animation: ani-width ease-in-out infinite;
top: 50%; top: 50%;
margin-top: -2px; margin-top: -2px;
} }

View File

@ -12,7 +12,7 @@
attributeType="XML" attributeType="XML"
:from="`0, ${line1Length / 2}, 0, ${line1Length / 2}`" :from="`0, ${line1Length / 2}, 0, ${line1Length / 2}`"
:to="`0, 0, ${line1Length}, 0`" :to="`0, 0, ${line1Length}, 0`"
dur="1.2s" :dur="`${dur}s`"
begin="0s" begin="0s"
calcMode="spline" calcMode="spline"
keyTimes="0;1" keyTimes="0;1"
@ -31,7 +31,7 @@
attributeType="XML" attributeType="XML"
:from="`0, ${line2Length / 2}, 0, ${line2Length / 2}`" :from="`0, ${line2Length / 2}, 0, ${line2Length / 2}`"
:to="`0, 0, ${line2Length}, 0`" :to="`0, 0, ${line2Length}, 0`"
dur="1.2s" :dur="`${dur}s`"
begin="0s" begin="0s"
calcMode="spline" calcMode="spline"
keyTimes="0;1" keyTimes="0;1"
@ -59,6 +59,10 @@ export default {
color: { color: {
type: Array, type: Array,
default: () => ([]) default: () => ([])
},
dur: {
type: Number,
default: 1.2
} }
}, },
data () { data () {