📄 useTransition/demo¶
📊 Analysis Summary¶
| Metric | Count |
|---|---|
| 🔧 Functions | 3 |
| 📦 Imports | 4 |
| 📊 Variables & Constants | 2 |
📚 Table of Contents¶
🛠️ File Location:¶
📂 packages/core/useTransition/demo.vue
📦 Imports¶
| Name | Source |
|---|---|
rand |
@vueuse/core |
TransitionPresets |
@vueuse/core |
useTransition |
@vueuse/core |
shallowRef |
vue |
Variables & Constants¶
| Name | Type | Kind | Value | Exported |
|---|---|---|---|---|
duration |
1500 |
let/var | 1500 |
✗ |
greetings |
string[] |
let/var | [ 'Ahoj', 'Bok', 'Ciao', 'Czesc', 'Hallo', 'Hei', 'Hej', 'Hello', 'Hola', 'Me... |
✗ |
Functions¶
easeOutElastic(n: number): number¶
Parameters:
nnumber
Returns: number
Calls:
Math.sin
Code
wordlerp(from: string, target: string, alpha: number): string¶
Parameters:
fromstringtargetstringalphanumber
Returns: string
Calls:
from.padEndtarget.padEndfrom.splitarr.joinarr[i].charCodeAttarget.charCodeAtString.fromCharCodesteps.pushMath.round
Code
function wordlerp(from: string, target: string, alpha: number) {
from = from.padEnd(target.length)
target = target.padEnd(from.length)
const arr = from.split('')
const steps = [from]
while (arr.join('') !== target) {
for (let i = 0; i < arr.length; i++) {
const current = arr[i].charCodeAt(0)
const next = target.charCodeAt(i)
if (current < next) {
arr[i] = String.fromCharCode(current + 1)
break
}
else if (current > next) {
arr[i] = String.fromCharCode(current - 1)
break
}
}
steps.push(arr.join(''))
}
if (alpha <= 0)
return steps[0]
if (alpha >= 1)
return steps[steps.length - 1]
return steps[Math.round(alpha * (steps.length - 1))]
}
toggle(): void¶
Returns: void
Calls:
rand (from @vueuse/core)greetings.filter
Code
Generated by Syntax Scribe