misskey/src/client/components/sequential-entrance.vue

81 lines
1.5 KiB
Vue
Raw Normal View History

<template>
2020-02-06 10:11:14 +00:00
<transition-group v-if="$store.state.device.animation"
2020-02-15 09:39:45 +00:00
class="uupnnhew"
:data-direction="direction"
:data-reversed="reversed ? 'true' : 'false'"
name="staggered"
tag="div"
appear
>
<slot></slot>
</transition-group>
2020-02-06 10:11:14 +00:00
<div v-else>
<slot></slot>
</div>
</template>
<script lang="ts">
import Vue from 'vue';
export default Vue.extend({
props: {
delay: {
type: Number,
required: false,
default: 40
},
direction: {
type: String,
required: false,
default: 'down'
2020-02-06 05:23:01 +00:00
},
reversed: {
type: Boolean,
required: false,
default: false
}
},
methods: {
focus() {
this.$slots.default[0].elm.focus();
}
2020-02-15 09:39:45 +00:00
},
});
</script>
<style lang="scss">
2020-02-15 09:39:45 +00:00
.staggered-move {
2020-02-15 09:42:43 +00:00
transition: transform 0.7s cubic-bezier(0.23, 1, 0.32, 1) !important;
2020-02-15 09:39:45 +00:00
}
.uupnnhew[data-direction="up"] {
.staggered-enter {
opacity: 0;
transform: translateY(64px);
}
}
.uupnnhew[data-direction="down"] {
.staggered-enter {
opacity: 0;
transform: translateY(-64px);
}
}
.uupnnhew[data-reversed="true"] {
@for $i from 1 through 30 {
.staggered-enter-active:nth-last-child(#{$i}) {
2020-02-15 09:42:43 +00:00
transition: transform 0.7s cubic-bezier(0.23, 1, 0.32, 1) (15ms * ($i - 1)), opacity 0.7s cubic-bezier(0.23, 1, 0.32, 1) (15ms * ($i - 1));
2020-02-15 09:39:45 +00:00
}
}
}
.uupnnhew[data-reversed="false"] {
@for $i from 1 through 30 {
.staggered-enter-active:nth-child(#{$i}) {
2020-02-15 09:42:43 +00:00
transition: transform 0.7s cubic-bezier(0.23, 1, 0.32, 1) (15ms * ($i - 1)), opacity 0.7s cubic-bezier(0.23, 1, 0.32, 1) (15ms * ($i - 1));
2020-02-15 09:39:45 +00:00
}
}
}
</style>