Created
July 14, 2021 17:47
-
-
Save mattmaribojoc/8afd16ff18897bd9698a0bbd2f2a5245 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <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