1
1
<script setup lang="ts">
2
- import { usePlayer , useWidget } from ' @vue-motion/core'
3
- import { Motion , grow } from ' @vue-motion/lib'
4
- import { onMounted } from ' vue'
2
+ import { defineAnimation , usePlayer , useWidget } from ' @vue-motion/core'
3
+ import { Line , Motion , grow } from ' @vue-motion/lib'
4
+ import { onMounted , ref } from ' vue'
5
5
import type { MathFunction } from ' @vue-motion/extension-math'
6
6
import type { BubbleChart } from ' @vue-motion/extension-chart'
7
- import { BarChart , ChartData , ChartDataset , ChartUtil , LineChart , MixedChart } from ' @vue-motion/extension-chart'
7
+ // import { BarChart, ChartData, ChartDataset, ChartUtil, LineChart, MixedChart } from '@vue-motion/extension-chart'
8
8
import { DateTime , Duration } from ' luxon'
9
9
10
- const fn1 = useWidget <InstanceType <typeof MathFunction >>(' fn1' )
11
- const fn2 = useWidget <InstanceType <typeof MathFunction >>(' fn2' )
12
- const fn3 = useWidget <InstanceType <typeof MathFunction >>(' fn3' )
13
- const chart1 = useWidget <InstanceType <typeof BubbleChart >>(' chart1' )
10
+ // const fn1 = useWidget<InstanceType<typeof MathFunction>>('fn1')
11
+ // const fn2 = useWidget<InstanceType<typeof MathFunction>>('fn2')
12
+ // const fn3 = useWidget<InstanceType<typeof MathFunction>>('fn3')
13
+ const line = useWidget <InstanceType <typeof BubbleChart >>(' www' )
14
+
15
+ const x = ref (0 )
16
+
17
+ const change = defineAnimation ((_context , progress ) => {
18
+ x .value = progress * 4000
19
+ })
14
20
15
21
onMounted (() => {
16
22
const { play, useAnimation } = usePlayer ()
17
23
18
- useAnimation (fn1 )
19
- .animate (grow , { duration: 1 })
20
- useAnimation (fn2 )
21
- .animate (grow , { duration: 1 })
22
- useAnimation (fn3 )
23
- .animate (grow , { duration: 1 })
24
- useAnimation (chart1 )
25
- .animate (grow , { duration: 4 })
24
+ // useAnimation(fn1)
25
+ // .animate(grow, { duration: 1 })
26
+ // useAnimation(fn2)
27
+ // .animate(grow, { duration: 1 })
28
+ // useAnimation(fn3)
29
+ // .animate(grow, { duration: 1 })
30
+ useAnimation (line )
31
+ .animate (change , { duration: 4 })
26
32
27
33
play ()
28
34
})
29
35
</script >
30
36
31
37
<template >
32
38
<Motion id =" motion" :width =" 1000" :height =" 1000" >
39
+ <Line :from =" [0, 0]" :to =" [x, 1000]" wid =" www" :border-width =" x" />
33
40
<!-- <Group> -->
34
41
<!-- <NumberPlane :ranges-x="[-5, 5]" :ranges-y="[-5, 5]" :grid="false"/> -->
35
42
<!-- <MathFunction :fn="(x) => Math.sin(x)" color="skyblue" :domain="[0, 0]" :ranges="[0, 5]" wid="fn1" /> -->
@@ -39,7 +46,7 @@ onMounted(() => {
39
46
<!-- <Group> -->
40
47
<!-- <NumberPlane :ranges-x="[0, 10]" :ranges-y="[0, 10]" /> -->
41
48
<!-- </Group> -->
42
- <MixedChart
49
+ <!-- < MixedChart
43
50
:labels="ChartUtil.dateSequence(
44
51
DateTime.fromISO('2021-01-01').setLocale('en-US'),
45
52
Duration.fromObject({ months: 4 }),
@@ -61,8 +68,8 @@ onMounted(() => {
61
68
<ChartData :cross="1" />
62
69
<ChartData :cross="3" />
63
70
<ChartData :cross="2" />
64
- <!-- < ChartData :cross="1.5" :index="DateTime.fromISO('2021-03-15').setLocale('en-US')" :weight="10" /> -->
65
- </ChartDataset >
71
+ <ChartData :cross="1.5" :index="DateTime.fromISO('2021-03-15').setLocale('en-US')" :weight="10" /> -->
72
+ <!-- </ChartDataset>
66
73
</BarChart>
67
74
<LineChart>
68
75
<ChartDataset label="Line1" :style="{ borderColor: '#00f', backgroundColor: '#00f' }">
@@ -79,6 +86,6 @@ onMounted(() => {
79
86
<ChartData :cross="1.5" :index="DateTime.fromISO('2021-03-15').setLocale('en-US')" :weight="10" />
80
87
</ChartDataset>
81
88
</LineChart>
82
- </MixedChart >
89
+ </MixedChart> -->
83
90
</Motion >
84
91
</template >
0 commit comments