Hi,
I seem to be often struggling with applying certain additional Ionic API’s to my codebase.
At this moment I’m trying out the basics of the new Animations API, but I cannot even get the simplest example to work.
Does anyone know what I do wrong?
<template>
<ion-page>
<ion-content fullscreen>
<div ref="pages" class="pages">
Pages
</div>
</ion-content>
</ion-page>
</template>
<script lang="ts">
import { IonContent, IonPage, createAnimation } from '@ionic/vue'
import { ref, onMounted, defineComponent } from 'vue'
export default defineComponent({
name: 'Editor',
components: {
IonPage,
IonContent,
},
setup(){
const pages = ref()
const animation = createAnimation()
.addElement(pages.value)
.duration(1500)
.iterations(Infinity)
.fromTo('transform', 'translateX(0px)', 'translateX(100px)')
.fromTo('opacity', '1', '0.2')
onMounted(() => {
animation.play()
})
return { pages }
},
})
</script>