也曾年轻 发表于 2026-5-12 13:41

王华还金

本帖最后由 也曾年轻 于 2026-5-12 15:37 编辑 <br /><br /><meta name="referrer" content="never" />
<div style="width:1080px;height:720px;position:relative;margin:50px auto 30px calc(50% - 621px);box-shadow:4px 4px 10px black;">
<img src="https://mmbiz.qpic.cn/mmbiz_png/YMyBubkxrPAIh1YU1ibnL8Pu6iaarBb3WxxWic5THJXLTvc9u6ibbbLu1ONgeSGxI1CsVeKU5Vbv7tPDecLEYax9lkf335SRj4l2T9rXnCibR4ro/640" />
<p style="position:absolute;left:60px;top:450px;text-indent:2em;letter-spacing:4px; margin:12px auto;height:auto;line-height:150%; font:bold 2em sans-serif;width:960px;" id="txtHold">
</p>
</div>
      <p style="text-align: center; line-height: 1; visibility: visible;writing-mode:vertical-lr;margin-left:100px">
          <span style="font-size: 2em; color: rgb(54, 129, 113); visibility: visible;margin-:4px" >
            <span leaf="" style="visibility: visible;">六岁童心不染尘</span>
          </span><br><br>
          <span style="font-size: 2em; color: rgb(54, 129, 113); visibility: visible;" >
            <span leaf="" style="visibility: visible;">&emsp;&emsp;沉金守待失金人</span>
          </span><br><br>
          <span style="font-size: 2em; color: rgb(54, 129, 113); visibility: visible;" >
            <span leaf="" style="visibility: visible;">&emsp;分毫不取清风志</span>
          </span><br><br>
          <span style="font-size: 2em; color: rgb(54, 129, 113); visibility: visible;" >
            <span leaf="" style="visibility: visible;">&emsp;&emsp;&emsp;千古传扬信与仁</span>
          </span>
      </p>

<script>
const descStr = [
`王华六岁,与群儿戏水滨,见一客来濯足,以大醉,去,遗所提囊。取视之,数十金也。公度其醒必复来,恐人持去,以投水中,坐守之。少顷,其人果号而至,公迎谓曰:\"求尔金耶?\" 为指其处。其人喜,以一铤为谢,却不受。`,
''
];
const loadJs = (url, callback) => {
    var script = document.createElement('script');
    script.charset = 'utf-8';
    script.src = url;
    script.onload = function() {
      if (callback) callback();
    };
    document.head.appendChild(script);
}
var txtHold = document.querySelector('#txtHold');
txtHold.innerHTML = '';
var cIdx = 0;
var strlen = descStr.length;
let cStr = '';
const synth = window.speechSynthesis;
function doTTS(){
        var utterance = new SpeechSynthesisUtterance(descStr);
        utterance.lang = 'zh-CN'; // 设置语言为中文
        utterance.rate = 1; // 设置语速
        utterance.pitch = 1; // 设置音调
        synth.speak(utterance); // 播放语音
        utterance.onend = typeWriter;
}

function typeWriter()        {
        r = parseInt(Math.random() * 128);
        g = parseInt(Math.random() * 128);
        b = parseInt(Math.random() * 128);
        if(cIdx == 0) {
                doTTS();
                cStr = '';
                txtHold.innerHTML = '';
        }

        cStr += `<span style='color:rgb(${r}, ${g}, ${b})'>${descStr.substring(cIdx, cIdx + 1)}</span>`;
        txtHold.innerHTML = cStr;
       
        cIdx++;
        if(cIdx > strlen)        {
                cIdx = 0;
                strlen = descStr.length;
        }
        else        {
                setTimeout(typeWriter, 200);
        }
}

loadJs("https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js", function(){
        var jq = jQuery.noConflict();
        loadJs("https://cccimg.com/down.php/7c1c6612dad45faa00772a24e98a5c48.js", typeWriter);
});

</script>

梦江南 发表于 2026-5-12 13:54

评分评不了

梦江南 发表于 2026-5-12 13:54

评分评不了

梦江南 发表于 2026-5-12 13:55

这是用电脑中的声音读的吗?

也曾年轻 发表于 2026-5-12 15:11

梦江南 发表于 2026-5-12 13:55
这是用电脑中的声音读的吗?

电脑合成的语音。

梦江南 发表于 2026-5-12 15:14

也曾年轻 发表于 2026-5-12 15:11
电脑合成的语音。

就是上次说的那种语音?

也曾年轻 发表于 2026-5-12 15:37

梦江南 发表于 2026-5-12 15:14
就是上次说的那种语音?

嗯,配合说明字串打字机输出

梦江南 发表于 2026-5-12 15:44

也曾年轻 发表于 2026-5-12 15:37
嗯,配合说明字串打字机输出

这厉害了,就不用麻烦数字人去朗读了。{:4_199:}

也曾年轻 发表于 2026-5-12 16:04

梦江南 发表于 2026-5-12 15:44
这厉害了,就不用麻烦数字人去朗读了。

适合解释性文字说明,不是呆板的显示出来。
页: [1]
查看完整版本: 王华还金