amp-google-vrview-image

Edit on Github
Open in Playground View Demo

Experimental Mode

This example uses the following experimental feature: [amp-google-vrview-image]. Enable the experiment via the button below. Some components require the AMP Dev Channel to be enabled as well. Learn more here.

Enable Dev Channel

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.

Example

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

Add the stereo attribute for stereoscopic images

Example

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

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

Example

<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>

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

Example

<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>