summaryrefslogtreecommitdiff
path: root/packages/client/src/components
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2022-09-02 00:22:31 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2022-09-02 00:22:31 +0900
commit25f4c8688abdd23b93038bf8339ac0eca0f63330 (patch)
tree5342c4e0d31391631461befd7f926b033470cc66 /packages/client/src/components
parentrefactor(client): use setup syntax (diff)
downloadmisskey-25f4c8688abdd23b93038bf8339ac0eca0f63330.tar.gz
misskey-25f4c8688abdd23b93038bf8339ac0eca0f63330.tar.bz2
misskey-25f4c8688abdd23b93038bf8339ac0eca0f63330.zip
refactor(client): use setup syntax
Diffstat (limited to 'packages/client/src/components')
-rw-r--r--packages/client/src/components/MkRipple.vue99
1 files changed, 46 insertions, 53 deletions
diff --git a/packages/client/src/components/MkRipple.vue b/packages/client/src/components/MkRipple.vue
index 401e78e304..9d93211d5f 100644
--- a/packages/client/src/components/MkRipple.vue
+++ b/packages/client/src/components/MkRipple.vue
@@ -1,8 +1,9 @@
<template>
-<div class="vswabwbm" :style="{ zIndex, top: `${y - 64}px`, left: `${x - 64}px` }" :class="{ active }">
+<div class="vswabwbm" :style="{ zIndex, top: `${y - 64}px`, left: `${x - 64}px` }">
<svg width="128" height="128" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg">
<circle fill="none" cx="64" cy="64">
- <animate attributeName="r"
+ <animate
+ attributeName="r"
begin="0s" dur="0.5s"
values="4; 32"
calcMode="spline"
@@ -10,7 +11,8 @@
keySplines="0.165, 0.84, 0.44, 1"
repeatCount="1"
/>
- <animate attributeName="stroke-width"
+ <animate
+ attributeName="stroke-width"
begin="0s" dur="0.5s"
values="16; 0"
calcMode="spline"
@@ -21,7 +23,8 @@
</circle>
<g fill="none" fill-rule="evenodd">
<circle v-for="(particle, i) in particles" :key="i" :fill="particle.color">
- <animate attributeName="r"
+ <animate
+ attributeName="r"
begin="0s" dur="0.8s"
:values="`${particle.size}; 0`"
calcMode="spline"
@@ -29,7 +32,8 @@
keySplines="0.165, 0.84, 0.44, 1"
repeatCount="1"
/>
- <animate attributeName="cx"
+ <animate
+ attributeName="cx"
begin="0s" dur="0.8s"
:values="`${particle.xA}; ${particle.xB}`"
calcMode="spline"
@@ -37,7 +41,8 @@
keySplines="0.3, 0.61, 0.355, 1"
repeatCount="1"
/>
- <animate attributeName="cy"
+ <animate
+ attributeName="cy"
begin="0s" dur="0.8s"
:values="`${particle.yA}; ${particle.yB}`"
calcMode="spline"
@@ -51,59 +56,47 @@
</div>
</template>
-<script lang="ts">
-import { defineComponent, onMounted } from 'vue';
+<script lang="ts" setup>
+import { onMounted } from 'vue';
import * as os from '@/os';
-export default defineComponent({
- props: {
- x: {
- type: Number,
- required: true
- },
- y: {
- type: Number,
- required: true
- },
- particle: {
- type: Boolean,
- required: false,
- default: true,
- }
- },
- emits: ['end'],
- setup(props, context) {
- const particles = [];
- const origin = 64;
- const colors = ['#FF1493', '#00FFFF', '#FFE202'];
+const props = withDefaults(defineProps<{
+ x: number;
+ y: number;
+ particle?: boolean;
+}>(), {
+ particle: true,
+});
- if (props.particle) {
- for (let i = 0; i < 12; i++) {
- const angle = Math.random() * (Math.PI * 2);
- const pos = Math.random() * 16;
- const velocity = 16 + (Math.random() * 48);
- particles.push({
- size: 4 + (Math.random() * 8),
- xA: origin + (Math.sin(angle) * pos),
- yA: origin + (Math.cos(angle) * pos),
- xB: origin + (Math.sin(angle) * (pos + velocity)),
- yB: origin + (Math.cos(angle) * (pos + velocity)),
- color: colors[Math.floor(Math.random() * colors.length)]
- });
- }
- }
+const emit = defineEmits<{
+ (ev: 'end'): void;
+}>();
- onMounted(() => {
- window.setTimeout(() => {
- context.emit('end');
- }, 1100);
+const particles = [];
+const origin = 64;
+const colors = ['#FF1493', '#00FFFF', '#FFE202'];
+const zIndex = os.claimZIndex('high');
+
+if (props.particle) {
+ for (let i = 0; i < 12; i++) {
+ const angle = Math.random() * (Math.PI * 2);
+ const pos = Math.random() * 16;
+ const velocity = 16 + (Math.random() * 48);
+ particles.push({
+ size: 4 + (Math.random() * 8),
+ xA: origin + (Math.sin(angle) * pos),
+ yA: origin + (Math.cos(angle) * pos),
+ xB: origin + (Math.sin(angle) * (pos + velocity)),
+ yB: origin + (Math.cos(angle) * (pos + velocity)),
+ color: colors[Math.floor(Math.random() * colors.length)],
});
+ }
+}
- return {
- particles,
- zIndex: os.claimZIndex('high'),
- };
- },
+onMounted(() => {
+ window.setTimeout(() => {
+ emit('end');
+ }, 1100);
});
</script>