Is there a way to scramble words letter by letter instead of the whole word at once in Vue.js? I'm new to Vue.js and struggling to make this change in my code. I'm currently using Vue.js for this task.
const sampleText1 = 'インバウント'
const characters =
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
const charactersLength = characters.length
export default {
data() {
return {
sam01: sampleText1,
}
},
setup() {
const texts = reactive({
text1: sampleText1,
})
const scrambleText = (text, name) => ({ progress }) => {
if (progress === 100) {
texts[name] = text
} else if (Math.floor(progress) % 20 === 0) {
texts[name] = text.replace(
/./g,
characters.charAt(Math.floor(Math.random() * charactersLength))
)
}
}
}
Click here to see the current output
Click here to see the expected output