@@ -128,6 +128,10 @@ function selectDatapoint(datapoint, index) {
128128 emits (' selectDatapoint' , { datapoint, index })
129129}
130130
131+ const animation = computed (() => {
132+ return ` ${ histoConfig .value .style .animation .speedMs } ms`
133+ })
134+
131135 </script >
132136
133137<template >
@@ -166,15 +170,17 @@ function selectDatapoint(datapoint, index) {
166170 :stroke =" rect.stroke"
167171 :stroke-width =" histoConfig.style.bars.strokeWidth"
168172 :rx =" `${histoConfig.style.bars.borderRadius * rect.proportion / 12}%`"
173+ :class =" {'vue-ui-sparkhistogram-shape' : histoConfig.style.animation.show }"
169174 />
170175 </g >
171- <g v-else >
176+ <g v-else >
172177 <Shape
173178 v-for =" (rect, i) in computedDataset"
174179 :plot =" { x: rect.x + rect.width / 2, y: rect.y + rect.height / 2 }"
175180 :color =" histoConfig.style.bars.colors.gradient.show ? rect.gradient : rect.color"
176181 :shape =" histoConfig.style.bars.shape"
177182 :radius =" rect.height * 0.4"
183+ :class =" {'vue-ui-sparkhistogram-shape' : histoConfig.style.animation.show }"
178184 />
179185 </g >
180186
@@ -238,4 +244,27 @@ function selectDatapoint(datapoint, index) {
238244
239245 </svg >
240246 </div >
241- </template >
247+ </template >
248+
249+ <style scoped>
250+ .vue-ui-sparkhistogram-shape {
251+ animation : expand v-bind(animation) ease-in forwards ;
252+ transform-origin : center ;
253+ transform : scale (1 , 0 );
254+ }
255+
256+ @keyframes expand {
257+ 80% {
258+ transform : scale (1 , 1.1 );
259+ }
260+ 90% {
261+ transform : scale (1 , 0.95 );
262+ }
263+ 95% {
264+ transform : scale (1 , 1.03 );
265+ }
266+ 100% {
267+ transform : scale (1 , 1 );
268+ }
269+ }
270+ </style >
0 commit comments