little-game-and-simple-software / EasyAvg.js

EasyAvg.js简易视觉小说游戏框架.js ,使用免费,技术支持服务付费,当然欢迎大家贡献代码
https://little-game-and-simple-software.github.io/EasyAvgFrameWork/bin/%E9%9F%B3%E4%B9%90%E9%A4%90%E5%8E%85/MainMenu.html
MIT License
15 stars 1 forks source link

第二版dialog #19

Open 2439905184 opened 1 year ago

2439905184 commented 1 year ago
<p id="dialog"></p>
    <script>
    var dialog = document.getElementById("dialog")

    var text="a sentence"
    var text2="测试 程序也"
    var character_array = text2.split("")
    console.log(character_array)

    var ch_index = 0
    var ch_wait_time = 1000
    // dialog.innerText += character_array[0] + character_array[1] + character_array[2]
    // dialog.innerText = character_array[0]
    // var s="a"+" " +"s" 
    // console.log(s)
    var timer = setInterval(()=>
    {
        console.log(character_array[ch_index])
        dialog.innerText += character_array[ch_index]
        if(character_array[ch_index] == ' ')
        {
            dialog.innerText += '\xa0'
        }
        ch_index+= 1
        if(ch_index == character_array.length)
        {
            clearInterval(this.timer)
        }

    },ch_wait_time)
2439905184 commented 1 year ago

在新的重写引擎框架里面:vue-gal