vue 移动端过渡效果_Vue应用程序的超级简单魔术移动过渡

vue 移动端过渡效果

超速驾驶 (vue-overdrive)

Super easy magic-move transitions for Vue apps, powered by Ramjet.

由Ramjet支持的Vue应用程序的超级轻松魔术移动过渡。

项目安装 (Project Install)

# npm
npm install vue-overdrive
# yarn
yarn add vue-overdrive

例子 (Examples)

Material

1)变形形状 (1) Morph Shapes)

https://vue-overdrive.netlify.com/#/shapes

https://vue-overdrive.netlify.com/#/shapes

Shape morph

2)材质转换 (2) Material-esque transformation)

https://vue-overdrive.netlify.com/#/libraries

https://vue-overdrive.netlify.com/#/libraries

Material transformation

3)iOS风格的图标效果 (3) iOS-inspired icon effect)

https://vue-overdrive.netlify.com/#/icons

https://vue-overdrive.netlify.com/#/icons

iOS icon effect

它是如何工作的? (How does it work?)

Just like with React Overdrive, wrap any two elements in a component. Add the same id to create a transition between the elements.

就像React Overdrive一样,将任意两个元素包装在一个 零件。 添加相同的ID,以在元素之间创建过渡。

导入并安装 (Import and install)

import Overdrive from 'vue-overdrive'
Vue.use(Overdrive)

or

要么

import { VOverdrive } from 'vue-overdrive'

// Register the component locally
components: {
  'overdrive': VOverdrive
}

使用Vue Router设置(至少)两条不同的路线 (Set up (at least) two different routes with Vue Router)

Inside your routes file –

在您的路线文件中–

{
  path: '/circle',
  name: 'Circle',
  component: Circle
},
{
  path: '/rectangle',
  name: 'Rectangle',
  component: Rectangle 
}

脚手架 (Scaffold your components)

In Circle.vue:

Circle.vue

<template>
  <overdrive id="element" :easing="easing" :duration="350">
    <div class="circle"></div>
  </overdrive>
</template>

<script>
import * as easing from 'eases/quart-in-out' // Bring 'yr own easing functions!
export default {
  name: 'el-circle',
  data () {
    return {
      easing
    }
  }
}
</script>

<style scoped>
  .circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: blue;
    float: left;
  }
</style>

And in Rectangle.vue

Rectangle.vue

<template>
  <overdrive id="element">
    <div class="rectangle"></div>
  </overdrive>
</template>

v-if用法 (Usage with v-if)

If you're not using Vue Router (and instead using Vue's built-in v-if directive), be sure to specify a unique key prop on each instance of <overdrive>

如果您不使用Vue路由器(而是使用Vue的内置v-if指令),请确保在<overdrive>每个实例上指定唯一的key道具

<overdrive key="a" id="window" :duration="450" v-if="!windowOpen">
  <!-- some element -->
</overdrive>
<overdrive key="b" id="window" :duration="450" v-if="windowOpen">
  <!-- some element -->
</overdrive>

自定义(API) (Customize it (API))

PropDescriptionDefault Value
idRequired. A unique string or number to identify the component.
tagWrapping element typediv
durationAnimation duration (in milliseconds)250
easingEasing Function (must pass a function)ramjet.linear
Struts 描述 默认值
ID 需要。 标识组件的唯一字符串或数字。
标签 包装元件类型 div
持续时间 动画持续时间(以毫秒为单位) 250
缓和 缓动功能(必须通过功能) ramjet.linear
EventDescription
@animation-endFires once the ramjet animation has completed
事件 描述
@animation-end 冲压喷气机动画完成后触发

去做 (Todo)

  • [ ] Minimize the jank (especially with v-if)

    []最小化垃圾(尤其是v-if )

  • [x] Find a non-Vuex solution for state management

    [x]查找用于状态管理的非Vuex解决方案

翻译自: https://vuejsexamples.com/super-easy-magic-move-transitions-for-vue-apps/

vue 移动端过渡效果

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值