Skip to content

Commit

Permalink
feat: Implements MsAnimation; Remove lottie
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoTuxx committed Apr 29, 2024
1 parent 2dbc00f commit ffa84b9
Show file tree
Hide file tree
Showing 13 changed files with 70 additions and 326 deletions.
266 changes: 0 additions & 266 deletions lib/assets/spinner.json

This file was deleted.

Binary file added lib/assets/spinner.riv
Binary file not shown.
3 changes: 3 additions & 0 deletions lib/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export * from '@lib/components/ms-input';
// ** ms-modal ** //
export * from '@lib/components/ms-modal';

// ** ms-animation ** //
export * from '@lib/components/ms-animation';

// ** ms-sorter ** //
export * from '@lib/components/ms-sorter';

Expand Down
47 changes: 47 additions & 0 deletions lib/components/ms-animation/MsAnimation.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!-- Parsec Cloud (https://parsec.cloud) Copyright (c) BUSL-1.1 2016-present Scille SAS -->

<template>
<canvas
ref="canvas"
:height="height || 24"
:width="width || 24"
:speed="speed || 1"
/>
</template>

<script setup lang="ts">
import { Rive } from '@rive-app/canvas';
import { onMounted, onUnmounted, ref } from 'vue';

const canvas = ref();
let riveInstance: Rive | null = null;

const props = defineProps<{
height?: number;
width?: number;
speed?: number;
src: string;
}>();

onMounted(() => {
if (canvas.value) {
fetch(props.src)
.then((response) => response.arrayBuffer())
.then((buffer) => {
riveInstance = new Rive({
canvas: canvas.value,
buffer: buffer,
autoplay: true,
});
});
}
});

onUnmounted(() => {
if (riveInstance) {
riveInstance.cleanup();
}
});
</script>

<style scoped lang="scss"></style>
4 changes: 4 additions & 0 deletions lib/components/ms-animation/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Parsec Cloud (https://parsec.cloud) Copyright (c) BUSL-1.1 2016-present Scille SAS
import MsAnimation from '@lib/components/ms-animation/MsAnimation.vue';

export { MsAnimation };
7 changes: 3 additions & 4 deletions lib/components/ms-spinner/MsSpinner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,18 @@
>
{{ $msTranslate(title) }}
</ion-text>
<vue3-lottie
<ms-animation
class="container-spinner"
:animation-data="SpinnerJSON"
src="/lib/assets/spinner.riv"
:height="height || 24"
:width="width || 24"
:speed="speed || 1"
:loop="true"
/>
</div>
</template>

<script setup lang="ts">
import SpinnerJSON from '@lib/assets/spinner.json';
import MsAnimation from '@lib/components/ms-animation/MsAnimation.vue';
import { Translatable } from '@lib/services/translation';
import { IonText } from '@ionic/vue';

Expand Down
2 changes: 0 additions & 2 deletions lib/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

import { TranslationPlugin } from '@lib/services';
import { App } from 'vue';
import Vue3Lottie from 'vue3-lottie';

export const MegaSharkPlugin = {
install: (app: App<any>): void => {
app.use(TranslationPlugin);
app.use(Vue3Lottie);
},
};
5 changes: 0 additions & 5 deletions lib/theme/components/lottie.scss

This file was deleted.

1 change: 0 additions & 1 deletion lib/theme/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ http://ionicframework.com/docs/theming/ */
@import 'components/cards';
@import 'components/inputs';
@import 'components/list';
@import 'components/lottie';
@import 'components/modals';
@import 'components/notifications';
@import 'components/toasts';
Expand Down
Loading

0 comments on commit ffa84b9

Please sign in to comment.