View in English

  • Apple 开发者
    • 入门汇总

    探索“入门汇总”

    • 概览
    • 学习
    • Apple Developer Program

    及时了解最新动态

    • 最新动态
    • 开发者你好
    • 平台

    探索“平台”

    • Apple 平台
    • iOS
    • iPadOS
    • macOS
    • Apple tvOS
    • visionOS
    • watchOS
    • App Store

    精选

    • 设计
    • 分发
    • 游戏
    • 配件
    • 网页
    • Home
    • CarPlay 车载
    • 技术

    探索“技术”

    • 概览
    • Xcode
    • Swift
    • SwiftUI

    精选

    • 辅助功能
    • App Intents
    • Apple 智能
    • 游戏
    • 机器学习与 AI
    • 安全性
    • Xcode Cloud
    • 社区

    探索“社区”

    • 概览
    • “与 Apple 会面交流”活动
    • 社区主导的活动
    • 开发者论坛
    • 开源

    精选

    • WWDC
    • Swift Student Challenge
    • 开发者故事
    • App Store 大奖
    • Apple 设计大奖
    • Apple Developer Centers
    • 文档

    探索“文档”

    • 文档库
    • 技术概述
    • 示例代码
    • 《人机界面指南》
    • 视频

    发布说明

    • 精选更新
    • iOS
    • iPadOS
    • macOS
    • watchOS
    • visionOS
    • Apple tvOS
    • Xcode
    • 下载

    探索“下载”

    • 所有下载
    • 操作系统
    • 应用程序
    • 设计资源

    精选

    • Xcode
    • TestFlight
    • 字体
    • SF Symbols
    • Icon Composer
    • 支持

    探索“支持”

    • 概览
    • 帮助指南
    • 开发者论坛
    • “反馈助理”
    • 联系我们

    精选

    • 《开发者账户帮助》
    • 《App 审核指南》
    • 《App Store Connect 帮助》
    • 即将实行的要求
    • 协议和准则
    • 系统状态
  • 快速链接

    • 活动
    • 新闻
    • 论坛
    • 示例代码
    • 视频
 

视频

打开菜单 关闭菜单
  • 专题
  • 所有视频
  • 关于

更多视频

  • 简介
  • 概要
  • 代码
  • 探索 visionOS 中的沉浸式网站环境

    借助 JavaScript 中新推出的 Immersive API,将你的网站访客带入 Apple Vision Pro 中的虚拟环境。探索如何从内联模型元素请求沉浸式过渡,利用视频对接等功能打造引人入胜的沉浸式体验,并优化性能以实现按真实比例复刻的丰富体验——只需在你的网站上运行几行代码即可。

    章节

    • 0:00 - Introduction
    • 1:46 - Meet the immersive API
    • 4:16 - Preview environments inline
    • 7:01 - Go immersive
    • 12:04 - Optimize the experience
    • 17:17 - Image controls
    • 18:09 - Next steps

    资源

    • Download - Immersive model add-on for Blender
    • WebKit.org - Theater Ticket Sales immersive website environment demo for Apple Vision Pro
    • WebKit.org - Escape Game immersive website demo for Apple Vision Pro
    • GitHub: Spatial Backdrop explainer
    • WebKit.org – Report issues to the WebKit open-source project
    • Submit feedback
      • 高清视频
      • 标清视频

    相关视频

    WWDC26

    • 为 visionOS App 和空间网络设计沉浸式环境
    • 面向 Safari 浏览器 27 的 WebKit 新功能
    • HTML 模型元素入门

    WWDC25

    • 空间网页的新功能
    • 针对 visionOS 优化你的自定环境
  • 搜索此视频…
    • 1:51 - Basic model element

      <model src="teapot.usdz">
      </model>
    • 2:06 - Model element with environment map

      <model src="teapot.usdz"
      	environmentmap="kitchen.hdr">
      </model>
    • 4:40 - Adding the environment model on the page for inline preview

      <div class="seat-preview">
      	<model id="theater"
      		   src="theater-model.usdz"
      		   environmentmap="theater-lighting.hdr">
      	</model>
      </div>
    • 5:14 - Reset the model entity transform

      const theater = document.getElementById("theater");
      
      async function updateModelTransform() {
      	// Make sure the model is loaded
      	await theater.ready;
      	// Create a transform matrix
      	const identity = new DOMMatrix();
      	// Apply the transform matrix to the model
      	theater.entityTransform = identity;
      }
      
      updateModelTransform();
    • 5:42 - Translate the model down

      const theater = document.getElementById("theater");
      
      async function updateModelTransform() {
      	// Make sure the model is loaded
      	await theater.ready;
      	// Create a transform matrix
      	const transform = new DOMMatrix();
      	// Translate model down, for eye level preview
      	transform.translateSelf(
      		0, 			// x
      		-1.0, 	// y
      		0 			// z
      	);
      	// Apply the transform matrix to the model
      	theater.entityTransform = transform;
      }
      
      updateModelTransform();
    • 6:40 - Build the seat transform

      function buildTransform(seat) {
      	const transform = new DOMMatrix();
      	const { x, y, z, ry } = seat;
      	// Rotate and translate the model to match 
        // the seat's origin and orientation
      	transform.rotateSelf(0, -ry, 0);
      	transform.translateSelf(-x, -y, -z);
      	// Translate the model down, for eye level preview
      	transform.translateSelf(0, -1.0, 0);
      	return transform;
      }
    • 7:16 - Detect feature availability

      if (document.immersiveEnabled) {
      	immersiveButton.hidden = false;
      }
    • 7:34 - Request the immersive transition on the model

      immersiveButton.addEventListener("click", async () => {
      	await model.requestImmersive();
      });
    • 8:24 - Build immersive transform

      function buildTransform(seat, immersive) {
      	const transform = new DOMMatrix();
      	// [...] Seat transform logic
      	if (immersive) {
      		// Rotate to the left
      		transform.rotateSelf(
      			0,		// x
      			45,		// y
      			0			// z
      		);
      	} else {
      		// [...] Eye level translation
      	}
      	return transform;
      }
    • 9:01 - Update the entity transform and the layout on immersive state updates

      theater.addEventListener("immersivechange", () => {
      	const isImmersive = !!document.immersiveElement;
      	const transform = buildTransform(isImmersive, currentSeat);
      	theater.entityTransform = transform;
        document.body.classList.toggle("immersive", isImmersive);
      });
    • 10:53 - Hide the inline preview

      <model id="escapeRoom"
      	   src="escape-room.usdz"
      	   environmentmap="room-lighting.hdr"
      	   style="display: none">
      </model>
    • 11:25 - Request an immersive transition on the escape room model

      const enterButton = document.getElementById("enterButton");
      const escapeRoom = document.getElementById("escapeRoom");
      
      enterButton.addEventListener("click", () => {
          await escapeRoom.requestImmersive();
      });
    • 11:52 - Handle the request result and show a loading animation

      enterButton.addEventListener("click", async () => {
      	showLoadingAnimation();            
      	try {
      		await escapeRoom.requestImmersive();
      	} catch (error) {
      		console.log(error);
      	} finally {
      		hideLoadingAnimation();
      	}
      });
    • 13:16 - Dock the video in the environment with the fullscreen API

      const trailerVideo = document.getElementById("trailerVideo");
      const demoButton = document.getElementById("demoButton");
      
      demoButton.addEventListener("click", async () => {
      	await trailerVideo.requestFullscreen();
      });
    • 14:01 - Play the model animation

      const trailerVideo = document.getElementById("trailerVideo");
      const escapeRoom = document.getElementById("escapeRoom");
      
      trailerVideo.addEventListener("ended", async () => {
      	await document.exitFullscreen();
      	escapeRoom.play();
      });
    • 16:38 - Compress your USDZ with usdcrush

      usdcrush model.usdz -o optimized.usdz
    • 0:00 - Introduction
    • The immersive API in visionOS Safari is previewed through two example websites — a theater ticket sales experience and an escape-room marketing site — that transport visitors into virtual environments using just a few lines of code.

    • 1:46 - Meet the immersive API
    • Get a high-level overview of how the HTML `` element pairs with the new JavaScript `requestImmersive()` API and a `:immersive` CSS pseudo-class. Unlike the Fullscreen API, the immersive API opens an environment around your existing webpage rather than replacing its content.

    • 4:16 - Preview environments inline
    • Build the inline portion of the ticket sales site: load a theater model into the page, let visitors pick a seat by applying a `DOMMatrix` transform to the `` element, and prepare the same model for an immersive transition.

    • 7:01 - Go immersive
    • Transition from the inline preview into a full immersive environment. Covers the difference between inline and immersive coordinate systems, listening to `immersivechange` events, dismissing the environment, and skipping the inline preview entirely for the escape-room marketing site.

    • 12:04 - Optimize the experience
    • Polish your environment with RealityKit annotations authored in Reality Composer Pro or via a Blender plugin. Dock playing video into a TV inside the scene, trigger model animations from JavaScript, cast Safari's window shadow with the Scene Understanding component, and reduce vertex/entity counts to keep assets fast to load and render.

    • 17:17 - Image controls
    • Add a single `controls` attribute to an `` element to give visitors an immersive viewing affordance for spatial photos — a small markup change that pairs naturally with model-based environments.

    • 18:09 - Next steps
    • Try the immersive demos on webkit.org with an Apple Vision Pro, file feedback at bugs.webkit.org, and watch "Design immersive environments for visionOS apps and the spatial web" for the design principles behind great photorealistic environments.

Developer Footer

  • 视频
  • WWDC26
  • 探索 visionOS 中的沉浸式网站环境
  • 打开菜单 关闭菜单
    • iOS
    • iPadOS
    • macOS
    • Apple tvOS
    • visionOS
    • watchOS
    打开菜单 关闭菜单
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • SF Symbols
    打开菜单 关闭菜单
    • 辅助功能
    • 配件
    • Apple 智能
    • App 扩展
    • App Store
    • 音频与视频 (英文)
    • 增强现实
    • 设计
    • 分发
    • 教育
    • 字体 (英文)
    • 游戏
    • 健康与健身
    • App 内购买项目
    • 本地化
    • 地图与位置
    • 机器学习与 AI
    • 开源资源 (英文)
    • 安全性
    • Safari 浏览器与网页 (英文)
    打开菜单 关闭菜单
    • 完整文档 (英文)
    • 部分主题文档 (简体中文)
    • 教程
    • 下载
    • 论坛 (英文)
    • 视频
    打开菜单 关闭菜单
    • 支持文档
    • 联系我们
    • 错误报告
    • 系统状态 (英文)
    打开菜单 关闭菜单
    • Apple 开发者
    • App Store Connect
    • 证书、标识符和描述文件 (英文)
    • 反馈助理
    打开菜单 关闭菜单
    • Apple Developer Program
    • Apple Developer Enterprise Program
    • App Store Small Business Program
    • MFi Program (英文)
    • Mini Apps Partner Program
    • News Partner Program (英文)
    • Video Partner Program (英文)
    • 安全赏金计划 (英文)
    • Security Research Device Program (英文)
    打开菜单 关闭菜单
    • 与 Apple 会面交流
    • Apple Developer Center
    • App Store 大奖 (英文)
    • Apple 设计大奖
    • Apple Developer Academies (英文)
    • WWDC
    阅读最近新闻。
    获取 Apple Developer App。
    版权所有 © 2026 Apple Inc. 保留所有权利。
    使用条款 隐私政策 协议和准则