#BlackLivesMatter
Do you build things with AMP? Fill out the new AMP Developer Survey!
AMP
  • websites

amp-google-vrview-image

Experimental

此示例使用了以下实验性功能: amp-google-vrview-image. 通过下方按钮启用实验。某些组件需要同时启用 AMP Dev Channel 。 Learn more about experimental features.

Introduction

The amp-google-vrview-image extension allows embedding 360 degree VR media into AMP pages.

If experimenting with this sample on a desktop web browser, you can interact with the displayed image by clicking on it and dragging the mouse around. The best way to perceive the effects enabled by this component is to view it on a mobile device and interact with the images by moving the device around using the cardboard viewer.

The attributes supported by this component are:

  • src: the source of the image being displayed
  • stereo: if provided, the image is considered to be a stereoscopic image; otherwise it is a monoscopic image.
  • yaw: initial yaw rotation of the viewer
  • yaw-only: if specified, restrict motion to yaw rotations only

Setup

Import the amp-google-vrview-image component in the header.

<script async custom-element="amp-google-vrview-image" src="https://cdn.ampproject.org/v0/amp-google-vrview-image-0.1.js"></script>

Basic usage

By default amp-google-vrview-image expects a mono image and the yaw value is 0.

<amp-google-vrview-image src="https://storage.googleapis.com/vrview/examples/coral.jpg"
  width="400"
  height="300"
  layout="responsive">
</amp-google-vrview-image>

Stereo

Add the stereo attribute for stereoscopic images

<amp-google-vrview-image src="https://storage.googleapis.com/vrview/examples/coral.jpg"
  stereo
  width="400"
  height="300"
  layout="responsive">
</amp-google-vrview-image>

Yaw

Add the stereo attribute for stereoscopic images. The initial yaw value is 90 degrees

<amp-google-vrview-image src="https://storage.googleapis.com/vrview/examples/coral.jpg"
  stereo
  yaw="90"
  width="400"
  height="300"
  layout="responsive">
</amp-google-vrview-image>

Yaw-only

Use the yaw-only attribute to restrict motion to the yaw axis only

<amp-google-vrview-image src="https://storage.googleapis.com/vrview/examples/coral.jpg"
  stereo
  yaw-only
  width="400"
  height="300"
  layout="responsive">
</amp-google-vrview-image>
需要进一步说明?

如果此页面的说明未能涵盖您的所有问题,欢迎与其他 AMP 用户取得联系,讨论您的具体用例。

前往 Stack Overflow
一项无法解释的功能?

AMP 项目强烈鼓励您参与其中并作出贡献!我们希望您能成为我们开源社区的持续参与者,但我们也欢迎您对热衷问题做出单次贡献。

在 GitHub 上编辑实例