js+css实现speechSynthesis数字人脸文本转声音开口说话效果代码

代码语言:html

所属分类:动画

代码描述:js+css实现speechSynthesis数字人脸文本转声音开口说话效果代码,采用gemini3生成。

代码标签: js css speechSynthesis 数字人 文本 声音 开口 说话

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SVG Talking Digital Avatar</title>
<style>
    body {
        background-color: #111;
        color: white;
        font-family: 'Segoe UI', sans-serif;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: 100vh;
        margin: 0;
    }

    /* 主容器 */
    .avatar-container {
        position: relative;
        width: 300px;
        height: 300px;
        margin-bottom: 30px;
        filter: drop-shadow(0 0 20px rgba(0, 255, 255, 0.3));
    }

    /* SVG 样式 */
    svg {
        width: 100%;
        height: 100%;
        overflow: visible;
    }

    /* 嘴巴的过渡动画,让说话更平滑 */
    #mouth-path {
        transition: d 0.1s ease-out; 
        fill: #ff6b6b;
    }

    /* 控制面板 */
    .controls {
        background: rgba(255, 255, 255, 0.1);
        padding: 20px;
        border-radius: 15px;
        backdrop-filter: blur(10px);
        display: flex;
        gap: 10px;
        width: 300px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    }

    input[type="text"] {
        flex: 1;
        padding: 10px;
        border-radius: 5px;
        border: 1px solid #444;
        background: #222;
        color: white;
        outline: none;
    }

    button {
        padding: 10px 20px;
        border: none;
        border-radius: 5px;
        background: #00ccff;
        color: #000;
        font-weight: bold;
        cursor: pointer;
        transition: tra.........完整代码请登录后点击上方下载按钮下载查看

网友评论0