import { storiesOf } from '@storybook/vue' import { defineComponent, computed } from '@vue/composition-api' import { useCubicBezier } from '../index' import md from '../docs/cubicBezier.md' const Demo = defineComponent({ template: `
EXAMPLE
bezier: {{bezier}}
easing: easeInQuad
fps: 60
duration: 2000
i'm fadeIn
i'm fadeOut
i'm running
   
`, setup() { const { bezier, run, stop } = useCubicBezier(60) const go = function () { run(2000, "easeInQuad").then() } // 渐显 const fadeIn = computed(() => { return { opacity: bezier.value } }) // 渐隐 const fadeOut = computed(() => { return { opacity: 1 - bezier.value } }) // 移动 const running = computed(() => { return { left: 130 + bezier.value * 200 + 'px' } }) return { bezier, go, stop, fadeIn, fadeOut, running } } }) storiesOf('UI|useCubicBezier', module) .add('cubicBezier', () => Demo, { readme: { sidebar: md }, })