Skip to content

Instantly share code, notes, and snippets.

@mattmaribojoc
Created July 14, 2021 17:47
Show Gist options
  • Select an option

  • Save mattmaribojoc/8afd16ff18897bd9698a0bbd2f2a5245 to your computer and use it in GitHub Desktop.

Select an option

Save mattmaribojoc/8afd16ff18897bd9698a0bbd2f2a5245 to your computer and use it in GitHub Desktop.
<template>
<h2 :style="{ color: color } "> COLOR CHANGING </h2>
</template>
<script setup>
import { ref, computed } from 'vue'
import { useTransition, TransitionPresets } from '@vueuse/core'
const source = ref([0, 0, 0])
const output = useTransition(source, {
duration: 3000,
transition: TransitionPresets.easeOutExpo,
})
const color = computed(() => {
const [r, g, b] = output.value
return `rgb(${r}, ${g}, ${b})`
})
source.value = [255, 0, 255]
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment