← back to Model Arena

data/artifacts/086d9b64d97d/qwen3-14b.html

106 lines

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Water Fountain</title>
  <style>
    html, body {
      margin: 0;
      padding: 0;
      height: 100%;
      background: #12002b;
      color: #f3e9ff;
      font-family: 'Didot', 'Bodoni MT', 'Playfair Display', Georgia, serif;
      overflow: hidden;
    }
    canvas {
      display: block;
    }
    .label {
      position: absolute;
      top: 24px;
      left: 50%;
      transform: translateX(-50%);
      font-size: 12px;
      text-transform: uppercase;
      letter-spacing: 0.15em;
      color: #8d7bb0;
      font-family: sans-serif;
    }
  </style>
</head>
<body>
  <div class="label">3D Water Fountain</div>
  <script src="https://cdn.jsdelivr.net/npm/three@0.155.0/build/three.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/three@0.155.0/examples/js/controls/OrbitControls.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/three@0.155.0/examples/js/objects/Water.js"></script>
  <script>
    let scene, camera, renderer, controls;
    let water;

    init();
    animate();

    function init() {
      scene = new THREE.Scene();
      scene.background = new THREE.Color(0x12002b);

      camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 1000);
      camera.position.set(0, 5, 10);

      renderer = new THREE.WebGLRenderer({ antialias: true });
      renderer.setSize(window.innerWidth, window.innerHeight);
      document.body.appendChild(renderer.domElement);

      controls = new THREE.OrbitControls(camera, renderer.domElement);
      controls.target.set(0, 2, 0);
      controls.update();

      // Ground
      const groundGeometry = new THREE.PlaneGeometry(100, 100);
      const groundMaterial = new THREE.MeshStandardMaterial({ color: 0x222222 });
      const ground = new THREE.Mesh(groundGeometry, groundMaterial);
      ground.rotation.x = -Math.PI / 2;
      scene.add(ground);

      // Water
      water = new THREE.Water(
        new THREE.PlaneGeometry(20, 20),
        {
          textureWidth: 512,
          textureHeight: 512,
          waterColor: 0x006699,
          distortionScale: 3.7,
          fog: scene.fog !== undefined
        }
      );
      water.rotation.x = -Math.PI / 2;
      scene.add(water);

      // Light
      const ambientLight = new THREE.AmbientLight(0xffffff, 0.6);
      scene.add(ambientLight);

      const directionalLight = new THREE.DirectionalLight(0xffffff, 1);
      directionalLight.position.set(10, 20, 10);
      scene.add(directionalLight);

      window.addEventListener('resize', onWindowResize, false);
    }

    function onWindowResize() {
      camera.aspect = window.innerWidth / window.innerHeight;
      camera.updateProjectionMatrix();
      renderer.setSize(window.innerWidth, window.innerHeight);
    }

    function animate() {
      requestAnimationFrame(animate);
      water.material.uniforms.time.value += 1.0 / 60.0;
      controls.update();
      renderer.render(scene, camera);
    }
  </script>
</body>
</html>