
表情测试
从笑到哭
Prompt
将一个小女孩正面显示,表情从笑到哭
A system prompt was added to support web rendering
我将创建一个交互式页面,展示小女孩从笑到哭的表情变化。以下是完整的HTML代码: ```html <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>小女孩表情变化</title> <style> body { font-family: 'Arial', sans-serif; background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%); min-height: 100vh; margin: 0; display: flex; flex-direction: column; align-items: center; padding: 20px; } h1 { color: #333; margin-bottom: 30px; text-shadow: 1px 1px 2px rgba(0,0,0,0.1); } .container { position: relative; width: 300px; height: 400px; margin: 0 auto 30px; } .girl { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 250px; height: 350px; background-color: #fff; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.15); overflow: hidden; transition: all 0.5s ease; } .face { position: relative; top: 20%; left: 50%; transform: translateX(-50%); width: 180px; height: 200px; } .eyes { display: flex; justify-content: space-around; position: absolute; top: 30%; width: 100%; } .eye { width: 30px; height: 20px; background: #333; border-radius: 50%; position: relative; overflow: hidden; } .eye::after { content: ''; position: absolute; width: 10px; height: 10px; background: white; border-radius: 50%; top: 5px; left: 8px; } .mouth { position: absolute; bottom: 30%; left: 50%; transform: translateX(-50%); width: 60px; height: 30px; border-radius: 0 0 50% 50%; background: #ff6b6b; transition: all 0.5s ease; } .teardrop { position: absolute; width: 15px; height: 15px; background: #3498db; border-radius: 50% 50% 50% 0; opacity: 0; transition: opacity 0.3s ease; } .controls { display: flex; gap: 15px; margin-bottom: 30px; } button { padding: 12px 25px; font-size: 16px; border: none; border-radius: 50px; cursor: pointer; background: #ff6b6b; color: white; box-shadow: 0 4px 8px rgba(255,107,107,0.3); transition: all 0.3s ease; } button:hover { transform: translateY(-3px); box-shadow: 0 6px 12px rgba(255,107,107,0.4); } .slider-container { width: 100%; max-width: 400px; margin: 20px 0; } .slider { width: 100%; height: 20px; -webkit-appearance: none; appearance: none; background: linear-gradient(to right, #ff6b6b, #3498db); border-radius: 10px; outline: none; } .slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 30px; height: 30px; border-radius: 50%; background: white; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.3); } .explanation { background: white; padding: 20px; border-radius: 15px; max-width: 600px; box-shadow: 0 5px 15px rgba(0,0,0,0.1); margin-top: 20px; } .labels { display: flex; justify-content: space-between; margin-top: 10px; color: #666; font-size: 14px; } </style> </head> <body> <h1>👧 小女孩的表情变化</h1> <div class="container"> <div class="girl"> <div class="face"> <div class="eyes"> <div class="eye"></div> <div class="eye"></div> </div> <div class="mouth"></div> <div class="teardrop" style="top: 70px; left: 45px;"></div> <div class="teardrop" style="top: 90px; left: 100px;"></div> <div class="teardrop" style="top: 80px; right: 40px;"></div> <div class="teardrop" style="top: 100px; right: 95px;"></div> </div> </div> </div> <div class="controls"> <button id="smileBtn">😊 笑脸</button> <button id="cryBtn">😢 哭泣</button> <button id="neutralBtn">😐 中性</button> </div> <div class="slider-container"> <input type="range" min="0" max="100" value="100" class="slider" id="expressionSlider"> <div class="labels"> <span>哭泣 😢</span> <span>中性 😐</span> <span>笑脸 😊</span> </div> </div> <div class="explanation"> <h3>表情变化说明</h3> <p>这个演示展示了小女孩从开心到哭泣的表情转变过程:</p> <ul> <li><strong>笑脸</strong>:嘴角上扬,呈现弧形微笑</li> <li><strong>中性</strong>:自然放松的表情状态</li> <li><strong>哭泣</strong>:嘴角下垂,脸上出现泪滴</li> </ul> <p>您可以使用按钮快速切换表情,或使用滑块平滑过渡不同表情状态。</p> </div> <script> document.addEventListener('DOMContentLoaded', function() { const mouth = document.querySelector('.mouth'); const teardrops = document.querySelectorAll('.teardrop'); const slider = document.getElementById('expressionSlider'); const smileBtn = document.getElementById('smileBtn'); const cryBtn = document.getElementById('cryBtn'); const neutralBtn = document.getElementById('neutralBtn'); // 初始状态:笑脸 setExpression(100); // 按钮事件 smileBtn.addEventListener('click', () => setExpression(100)); cryBtn.addEventListener('click', () => setExpression(0)); neutralBtn.addEventListener('click', () => setExpression(50)); // 滑块事件 slider.addEventListener('input', () => setExpression(slider.value)); // 设置表情函数 function setExpression(value) { // 更新滑块值 slider.value = value; // 嘴巴变化 if (value >= 66) { // 笑脸 mouth.style.borderRadius = '0 0 50% 50%'; mouth.style.height = '30px'; mouth.style.width = '70px'; mouth.style.bottom = '30%'; mouth.style.backgroundColor = '#ff6b6b'; } else if (value >= 33) { // 中性 mouth.style.borderRadius = '50%'; mouth.style.height = '5px'; mouth.style.width = '40px'; mouth.style.bottom = '45%'; mouth.style.backgroundColor = '#aaa'; } else { // 哭泣 mouth.style.borderRadius = '50% 50% 0 0'; mouth.style.height = '30px'; mouth.style.width = '40px'; mouth.style.bottom = '30%'; mouth.style.backgroundColor = '#ff6b6b'; } // 泪滴控制 teardrops.forEach(drop => { drop.style.opacity = value < 20 ? '1' : '0'; }); } }); </script> </body> </html> ``` 这个页面展示了一个卡通风格的小女孩,您可以通过以下方式操作她的表情: 1. **三个按钮**: - 😊 笑脸:显示开心的表情 - 😢 哭泣:显示伤心的表情 - 😐 中性:显示自然的表情 2. **表情滑块**:可以平滑过渡不同表情状态,从左到右分别对应: - 左侧:哭泣状态 😢 - 中间:中性状态 😐 - 右侧:笑脸状态 😊 3. **表情变化效果**: - 笑脸:嘴角上扬形成微笑 - 中性:嘴巴变为小椭圆形 - 哭泣:嘴角下垂并出现泪滴 页面采用响应式设计,适合在各种设备上查看,使用了柔和的渐变背景和卡片式布局,视觉效果清晰友好。
Drag to resize
Here's a simple HTML, CSS, and JavaScript code that animates a small girl's face transitioning from a smiling expression to a crying one. This example uses basic HTML5 Canvas and JavaScript for the animation. ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Girl Face Animation</title> <style> body { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background-color: #f0f0f0; } canvas { background-color: white; border-radius: 10px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } </style> </head> <body> <canvas id="girlCanvas" width="300" height="400"></canvas> <script> const canvas = document.getElementById('girlCanvas'); const ctx = canvas.getContext('2d'); // Draw the girl's face function drawGirl(emotion) { // Clear the canvas ctx.clearRect(0, 0, canvas.width, canvas.height); // Draw the head ctx.beginPath(); ctx.arc(150, 150, 100, 0, Math.PI * 2); ctx.fillStyle = '#ffd7d7'; ctx.fill(); ctx.strokeStyle = '#ff9999'; ctx.lineWidth = 2; ctx.stroke(); // Draw the eyes ctx.beginPath(); ctx.arc(120, 130, 15, 0, Math.PI * 2); ctx.arc(180, 130, 15, 0, Math.PI * 2); ctx.fillStyle = 'white'; ctx.fill(); ctx.strokeStyle = '#ff9999'; ctx.lineWidth = 2; ctx.stroke(); // Draw the pupils ctx.beginPath(); ctx.arc(120, 130, 8, 0, Math.PI * 2); ctx.arc(180, 130, 8, 0, Math.PI * 2); ctx.fillStyle = 'black'; ctx.fill(); // Draw the mouth if (emotion === 'smile') { ctx.beginPath(); ctx.arc(150, 180, 30, 0, Math.PI); ctx.strokeStyle = '#ff9999'; ctx.lineWidth = 2; ctx.stroke(); } else if (emotion === 'cry') { ctx.beginPath(); ctx.arc(150, 180, 30, 0, Math.PI); ctx.strokeStyle = '#ff9999'; ctx.lineWidth = 2; ctx.stroke(); // Draw tears ctx.beginPath(); ctx.moveTo(140, 170); ctx.lineTo(130, 200); ctx.lineTo(120, 230); ctx.strokeStyle = 'black'; ctx.lineWidth = 2; ctx.stroke(); ctx.beginPath(); ctx.moveTo(160, 170); ctx.lineTo(170, 200); ctx.lineTo(180, 230); ctx.strokeStyle = 'black'; ctx.lineWidth = 2; ctx.stroke(); } // Draw the hair ctx.beginPath(); ctx.moveTo(100, 80); ctx.bezierCurveTo(100, 50, 120, 30, 150, 40); ctx.bezierCurveTo(180, 50, 200, 50, 200, 80); ctx.bezierCurveTo(200, 110, 180, 130, 150, 120); ctx.bezierCurveTo(120, 130, 100, 110, 100, 80); ctx.closePath(); ctx.fillStyle = '#ff9999'; ctx.fill(); ctx.strokeStyle = '#ff6666'; ctx.lineWidth = 2; ctx.stroke(); // Draw the body ctx.beginPath(); ctx.moveTo(150, 250); ctx.lineTo(150, 350); ctx.lineWidth = 20; ctx.strokeStyle = '#ff9999'; ctx.stroke(); } // Animate the emotion change function animateEmotionChange() { let emotion = 'smile'; let progress = 0; function update() { progress += 0.01; if (progress >= 1) { progress = 1; emotion = 'cry'; } // Interpolate between smile and cry if (emotion === 'smile') { drawGirl('smile'); } else if (emotion === 'cry') { drawGirl('cry'); } if (progress < 1) { requestAnimationFrame(update); } } update(); } // Start the animation drawGirl('smile'); setTimeout(animateEmotionChange, 1000); </script> </body> </html> ``` This code creates a simple animation of a girl's face transitioning from a smiling expression to a crying one. The animation starts with a smile and gradually changes to a crying expression. The girl's face is drawn using HTML5 Canvas and JavaScript.
Drag to resize