Skip to content

Commit

Permalink
fix: incorrect coordinates
Browse files Browse the repository at this point in the history
  • Loading branch information
sheepbox8646 committed Oct 5, 2024
1 parent c16e788 commit 0874a1c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 31 deletions.
8 changes: 4 additions & 4 deletions packages/lib/src/motion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ provide('motion-height', props.height)
<template>
<svg
:viewBox="`0 0 ${width} ${height}`" style="background-color: black;" :style="{
transform: `scale(${props.scale})`,
minWidth: `${props.minWidth}px`,
minHeight: `${props.minHeight}px`,
}"
transform: `scale(${props.scale ?? 1})`,
minWidth: `${props.minWidth ?? width}px`,
minHeight: `${props.minHeight ?? height}px`,
}" :width="width" :height="height"
>
<g v-bind="figure({ x: width / 2, y: height / 2 })">
<slot />
Expand Down
45 changes: 18 additions & 27 deletions test/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,52 +1,43 @@
<script setup lang="ts">
import { usePlayer, useWidget } from '@vue-motion/core'
import { Group, Motion, grow } from '@vue-motion/lib'
import { Group, Motion, flash, grow, indicate, rotate, showCircleCreationThenDestructionAround } from '@vue-motion/lib'
import { onMounted } from 'vue'
import { MathFunction } from '@vue-motion/extension-math'
import { NumberPlane, PolarPlane } from '@vue-motion/extension-math'
import { Column, Container, Row } from '@vue-motion/extension-layout'
const fn1 = useWidget<InstanceType<typeof MathFunction>>('fn1')
const fn2 = useWidget<InstanceType<typeof MathFunction>>('fn2')
const fn3 = useWidget<InstanceType<typeof MathFunction>>('fn3')
const plane = useWidget<InstanceType<typeof PolarPlane>>('plane')
const plane2 = useWidget<InstanceType<typeof PolarPlane>>('plane2')
const plane3 = useWidget<InstanceType<typeof PolarPlane>>('plane3')
const plane4 = useWidget<InstanceType<typeof PolarPlane>>('plane4')
onMounted(() => {
const { play, useAnimation } = usePlayer()
useAnimation(fn1)
.animate(grow, { duration: 1 })
useAnimation(fn2)
.animate(grow, { duration: 1 })
useAnimation(fn3)
.animate(grow, { duration: 1 })
useAnimation(plane)
.animate(rotate, { duration: 10, offset: -1000 })
useAnimation(plane4)
.animate(rotate, { duration: 10, offset: 1000 })
useAnimation(plane2)
.animate(rotate, { duration: 10, offset: -1000 })
useAnimation(plane3)
.animate(rotate, { duration: 10, offset: 1000 })
play()
})
</script>

<template>
<Motion id="motion" :width="1000" :height="3000">
<Motion id="motion" :width="1600" :height="900">
<!-- <Group> -->
<!-- <NumberPlane :ranges-x="[-5, 5]" :ranges-y="[-5, 5]" :grid="false"/> -->
<!-- <MathFunction :fn="(x) => Math.sin(x)" color="skyblue" :domain="[0, 0]" :ranges="[0, 5]" wid="fn1" /> -->
<!-- <MathFunction :fn="(x) => Math.cos(x)" color="red" :domain="[0, 0]" :ranges="[0, 5]" wid="fn2" /> -->
<!-- <MathFunction :fn="(x) => Math.tan(x)" color="green" :domain="[0, 0]" :ranges="[0, 5]" wid="fn3" /> -->
<!-- </Group> -->
<Group>
<Column :height="6000">
<Container>
<PolarPlane :radius="300" />
</Container>
<Container>
<PolarPlane :radius="300" />
</Container>
<!-- <Container>
<PolarPlane :radius="300" />
</Container>
<Container>
<PolarPlane :radius="300" />
</Container> -->
</Column>
</Group>
<PolarPlane :radius="300" wid="plane" />
<NumberPlane :ranges-x="[-4, 4]" :ranges-y="[-4, 4]" wid="plane2" />
<NumberPlane :ranges-x="[-6, 6]" :ranges-y="[-6, 6]" wid="plane3" />
<PolarPlane :radius="500" wid="plane4" />
</Motion>
</template>

0 comments on commit 0874a1c

Please sign in to comment.