Skip to main content

Sirv Spin Documentation

Important: This documentation is for Sirv JS v2, which uses this script: https://scripts.sirv.com/sirv.js. We recommend using Sirv JS v3 instead. Go to the Sirv JS v3 spin documentation.

Create a 360 spin​

Sirv creates 360° and 3D spins from a set of images or a video. Some samples are shared in your Sirv account. If you're a new user, create a free account. To create a spin, you need a set of photos. If you need a photographer, visit the Sirv Experts website to find a professional photo studio in your country..

Spins can have any number of images from 2 to 1000. Photographers most commonly use 24, 36 or 72 images. Compare the best number of 360 spin images for your needs. Spins are automatically generated when:

  • The image names contain a sequence of ascending numerals.
  • Between 8 and 1000 images make up the sequence.

Manually create a spin​

If needed, you can also create a spin manually, from 2 or more images, regardless of their file names:

  1. Upload the images to your Sirv account.
  2. Select the images for your spin (save time with the Ctrl+A shortcut).
  3. Click the "Create spin" button.

You can also manually created spins by editing them. You would need to do this to create a multi-row spin with more than 1000 frames. There is a maximum file size limit of 256kb for a .spin file (typical spin files are smaller than 2kb).

Embed a 360 spin​

To embed a spin, click on the spin in your Sirv account. Copy the two lines of code into your web page. Paste the script code before your </head> if possible, otherwise paste it anywhere else on your page:Paste the div code where you want the spin to appear:


<div className="Sirv" data-src="https://demo.sirv.com/drill/drill.spin"></div>

Try pasting the code above and you'll see a spinning power drill.

To add spins to emails and social media, convert them to GIFs. Read the guides to embedding spins and GIFs to learn more.

Iframe​

Spins can alternatively be embedded with an <iframe>, though it has limitations. Advantages of iframe:

  • Can be embedded in your web page when other embed methods cannot.

Disadvantages of iframe:

  • Fullscreen option does not work on all browsers.
  • Scrollbars might be unnecessarily added to your page.

Due to its disadvantages, iframe is not recommended unless you have no other option. For example, some CMS or website control panels restrict you from adding any <script> code to your page. Therefore, iframe can be used as a solution. Facebook also restricts <script> tags in Facebook pages, so iframe is necessary. Note: while Facebook pages require iframe, Facebook posts use a different method - see how to post spins on Facebook. To use iframe, copy and paste the iframe code from your Sirv account:

8 Try it now, with this example code:

We recommended uploading images of at least 2500px width and as much as 4000px width, if possible. It will ensure your spins look sharp on all devices, including modern displays with very high definitions. By uploading your largest images, you're preparing for now and the future. Today's displays already go beyond 5000px in some cases: [table type="with-cell-border"]

MacBook Pro 13"2560×1600 pixels
MacBook Pro 15"2880×1800 pixels
iMac Slim Unibody 27"5120x2880 pixels

[/table] Sirv automatically resizes and optimizes images before they're served, so your users will always see the most perfectly optimized image for their device. Sirv automatically delivers hi-res images to retina devices. Retina images have 4 times the number of pixels as normal resolution images, so they look very sharp on iPhone, iPad and other retina screens. To compensate for the larger size, Sirv applies greater image compression (60% quality), to reduce the file size. This has a subtle and usually indistinguishable effect on image quality while improving the loading experience.

Generated images​

Your original images are always stored untouched. When a spin is requested, Sirv generates new images, resized and optimized to suit the user's device. Spins have 3 types of image:

  • Main images - shown on the page.
  • Zoom images - shown on click, to zoom in.
  • Fullscreen images - shown on click of the fullscreen button.

Images dimensions are determined like so:

  • Main images - automatically fit the width or max-height of your pages' containing element i.e. the div, table or span
  • Zoom images - automatically shown at 2.5 times larger than the main image.
  • Fullscreen images - automatically sized to the users' screen dimensions.

For faster loading, Sirv prepares images rounded up to the nearest hundred, and scales them down to the exact required size in the browser. This reduces processing load, for faster average delivery to users. Sirv can scale images beyond their original dimensions by changinga scale.option to fit, fill or ignore, though it is not recommended as they will lose clarity. Instead, upload larger images - at least 2500px width if possible.

Sirv Spin options​

Sirv provides many ways to customize your spins. Each option is described on this page, with a live demo:

[table type="with-cell-border"]

ParameterDefaultOptionsDescription
spindragdrag / hoverMethod for spinning the image.
spinOnAnyDragfalsetrue / falseRotate a single row spin by dragging up/down, as well as left/right.
startColumnautonumeric or autoStart spin with image in src or specify another column.
startRowautonumeric or autoStart spin with image in src or specify another row.
loopColumntruetrue / falseContinue spin after the last image on X-axis.
loopRowfalsetrue / falseContinue spin after the last image on Y-axis.
Auto spin
------------
autospinonceonce / twice / infinite / offAutomatically spin the image.
autospinSpeed3600numericThe time (ms) taken to complete 1 rotation.
autospinStartloadload / hover / click / or combination e.g. load, hoverStart autospin on page load, click or hover.
autospinStopclickclick / hover / neverStop autospin on click, hover or never.
autospinDirectionclockwiseclockwise / anticlockwise / alternate-clockwise / alternate-anticlockwiseDirection of rotation.
Fullscreen and zoom
------------
fullscreentruetrue / falseEnable full-screen spin when large images exist.
zoom2.50-10Zoom level on click (0 = disabled).
Text spin options
------------
loadingTextLoading...textText shown while loading.
fullscreenLoadingTextLoading large spin...textText shown while full-screen images loading.
hinttruetrue / falseHide the message & arrows for spinning the image.
hintTextDrag to spintextText shown once images have loaded.
mobileHintTextSwipe to spintextText shown on mobile devices once images have loaded.
Other settings
------------
initializeOnloadload / hover / clickWhen to download the images.
speed500-100Speed of spin while dragging (100 = fast).
reverseRotationoffrow / column / both / offReverse rotation on X or/and Y axes.
swapRowsColumnsfalsetrue / falseDisplay a vertical spin.
rightClickfalsetrue / falseShow right-click menu on the image.
mousewheelStep3numericNumber of frames to spin on mousewheel.

[/table]

How to Apply options​

There are four ways to apply options. They are ranked in order of priority:

  1. URL - append options to the end of the spin URL. The examples on this page use this method. Highest priority.
  2. Spin file - edit the options of a .spin file so that all variations of that spin inherit those options.
  3. Profile - choose your options in a profile and append it to the URL. Ideal for applying the same options to many spins.
  4. JavaScript - add a script in your page. Useful for gaining advanced programmatic control over all spins on a page. Lowest priority.

Interaction​

Spins can be controlled either by dragging or hovering. To make the spin rotate on hover/mouseover, set the spin option to hover, like so: https://demo.sirv.com/drill/drill.spin?spin=hover

Single row spins react to left/right dragging. To allow any direction dragging - including up/down - set spinOnAnyDrag to true. This is particularly suitable for twin-axis "Martini spins", which have one complete row and one complete column: https://demo.sirv.com/skateboard/skateboard.spin?spinOnAnyDrag=true Try dragging up/down or left/right:

You may want to disable spinOnAnyDrag on mobile devices, to permit the page to be dragged up/down. Set it to false in the data-mobile-options: <div className="Sirv" data-src="https://demo.sirv.com/skateboard/skateboard.spin?spinOnAnyDrag=true" data-mobile-options="spinOnAnyDrag:false;"></div>

First frame​

The first image of the spin is automatically the first one detected from the file names. To change this, set startColumn to a frame of your choice. This example sets the 27th frame as the first: https://demo.sirv.com/drill/drill.spin?startColumn=27

In a multi-row spin, you can choose the startRow as well as the startColumn. This example sets row 2 and column 8: https://demo.sirv.com/boot/boot.spin?startRow=2&startColumn=8

Loop​

Spins loop by showing the first frame after the last frame and vice versa. To prevent a spin from looping, set loopColumn to false. This is useful for spins that have an obvious beginning and end: https://demo.sirv.com/ipad/ipad.spin?loopColumn=false

Vertical spins have only one column and many rows, so set loopRow to true: https://demo.sirv.com/spins/karlmartini/Dyson/Dyson-vert.spin?loopRow=true <script> Sirv.instance('ExampleSpin').play(18); </script>0

Auto spin​

Spins automatically rotate once, after the images have downloaded. The autospin option can make it rotate twice, infinitely or not at all. This is an infinite spin: https://demo.sirv.com/drill/drill.spin?autospin=infinite <script> Sirv.instance('ExampleSpin').play(18); </script>1 An infinite spin will stop when the user interacts with it. You can set it to spin forever by setting autospinStop to never: https://demo.sirv.com/drill/drill.spin?autospin=infinite&autospinStop=never <script> Sirv.instance('ExampleSpin').play(18); </script>2

Auto spin speed​

The speed can be adjusted with autospinSpeed. The default speed is 3600 milliseconds (3.6 seconds) for one full rotation. A higher value will slow it down, a lower value will speed it up. https://demo.sirv.com/drill/drill.spin?autospin=infinite&autospinSpeed=1800

Default

<script> Sirv.instance('ExampleSpin').play(18); </script>3

1800ms

<script> Sirv.instance('ExampleSpin').play(18); </script>4

6000ms

<script> Sirv.instance('ExampleSpin').play(18); </script>5

Auto spin direction​

The spin direction can be reversed with autospinDirection, giving you an easy way to change the direction to anticlockwise or clockwise:

https://demo.sirv.com/drill/drill.spin?autospin=infinite&autospinDirection=anticlockwise

<script> Sirv.instance('ExampleSpin').play(18); </script>6

<script> Sirv.instance('ExampleSpin').play(18); </script>7

Spins which don't loop round in a 360 can go backwards and forwards instead. Set autospinDirection to either alternate-clockwise or alternate-anticlockwise: https://demo.sirv.com/ipad/ipad.spin?autospin=infinite&autospinDirection=alternate-clockwise <script> Sirv.instance('ExampleSpin').play(18); </script>8 To stop the spin from dragging beyond the first/last frame, set loopColumn to false. Try dragging the spin below: https://demo.sirv.com/ipad/ipad.spin?autospinDirection=alternate-clockwise&loopColumn=false <script> Sirv.instance('ExampleSpin').play(18); </script>9

Speed​

The speed at which the spin rotates on drag can be adjusted with the speed option. The default speed is 50, on a scale from 0 to 100. A lower value makes it more sensitive (faster), a higher value makes it less sensitive (slower): https://demo.sirv.com/drill/drill.spin?speed=20

Default speed

<script> var spin = document.getElementById('ExampleSpin'); Sirv.instance(spin).play(18); </script>0

Speed 20

<script> var spin = document.getElementById('ExampleSpin'); Sirv.instance(spin).play(18); </script>1

Speed 80

<script> var spin = document.getElementById('ExampleSpin'); Sirv.instance(spin).play(18); </script>2

Fullscreen​

A fullscreen button shows in the top right corner. It can be disabled by setting fullscreen to false: https://demo.sirv.com/drill/drill.spin?fullscreen=false <script> var spin = document.getElementById('ExampleSpin'); Sirv.instance(spin).play(18); </script>3 You can customize the fullscreen button and change the color of the fullscreen background.

Zoom​

Any frame can be zoomed by clicking the image (providing the master image is at least 20% bigger than the embedded image). If your original images are not large enough, zoom and fullscreen will be disabled. The zoomed image is 2.5 times larger by default. The magnification level can be adjusted. This example zooms to 5 times magnification: https://demo.sirv.com/drill/drill.spin?zoom=5 <script> var spin = document.getElementById('ExampleSpin'); Sirv.instance(spin).play(18); </script>4 Alternatively, zoom magnification can be set in pixels:

  1. In the spin settings or profile settings, set "zoom" to "1".
  2. Set your desired zoom size within Zoom image -> Scale.

Reverse rotation​

Clockwise rotation usually has a more natural feel than anticlockwise. If your spin is rotating in an anticlockwise direction on drag, set reverseRotation to column to reverse the X-axis movement: https://demo.sirv.com/boot/boot.spin?reverseRotation=column Drag the images to compare the difference:

<script> var spin = document.getElementById('ExampleSpin'); Sirv.instance(spin).play(18); </script>5

<script> var spin = document.getElementById('ExampleSpin'); Sirv.instance(spin).play(18); </script>6

To reverse the Y-axis, set reverseRotation to row. Try dragging the spins up and down: https://demo.sirv.com/boot/boot.spin?reverseRotation=row

<script> var spin = document.getElementById('ExampleSpin'); Sirv.instance(spin).play(18); </script>7

<script> var spin = document.getElementById('ExampleSpin'); Sirv.instance(spin).play(18); </script>8

To reverse both axes, set reverseRotation to both: https://demo.sirv.com/boot/boot.spin?reverseRotation=both <script> var spin = document.getElementById('ExampleSpin'); Sirv.instance(spin).play(18); </script>9 In case your image file names have column names before row names, use swapRowsColumns like this: https://demo.sirv.com/boot/boot.spin?swapRowsColumns=true

0

Initialization​

Sirv Spin automatically initializes and downloads the images at the end of page loading. Alternatively, you can set the images to download on click or hover, hence reducing data transfer. The first image of the spin will display until initialization is triggered. Set initializeOn to hover or click. This initializes on click: https://demo.sirv.com/drill/drill.spin?initializeOn=clickThis initializes on hover: https://demo.sirv.com/drill/drill.spin?initializeOn=hover

Faster initialization​

To load images faster, you can prefetch the DNS and pre-initiate the connection to Sirv resources. This best practice recommendation accelerates page loading and is automatically applied if you're using a Sirv plugin: Adobe Commerce CDN extension (formerly Magento), PrestaShop CDN addon and WordPress CDN plugin. Paste the code below between the <head> and </head> of your HTML page. Replace your-sirv-account with your Sirv account name. If you use a custom domain, replace your-sirv-account.sirv.com with your custom domain:





The preconnect and prefetch code will connect to your Sirv direct domain, your Sirv CDN domain and the scripts needed for responsive imaging, Sirv Spin, Sirv Zoom and Sirv Media Viewer. This technique typically loads files 100-300 ms sooner, for browsers that support preconnect. For browsers that only support DNS prefetch, it loads 10-150 ms sooner. You can measure the time taken for DNS lookup, initial connection and SSL handshake with your browser console. In Chrome, it looks like this:

9

Mousewheel​

Spins can be rotated with the mousewheel. By default, each click of the mousewheel rotates the spin by 3 frames. Change the amount with the mousewheelStep option, for example 1: https://demo.sirv.com/drill/drill.spin?mousewheelStep=1To disable mousewheel spin, set mousewheelStep to 0: https://demo.sirv.com/drill/drill.spin?mousewheelStep=0

Hint​

A hint is displayed on load, once the auto spin has stopped. It suggests to the user that it is an interactive image. The hint can be disabled by setting hint to false, for example: https://demo.sirv.com/drill/drill.spin?hint=false

1 Different hints are shown on desktop and mobile devices. Use hintText to change the text on desktops, e.g.: https://demo.sirv.com/drill/drill.spin?hintText=Left/Right

2 Use mobileHintText to change the text on mobile devices: https://demo.sirv.com/drill/drill.spin?mobileHintText=Swipe left/right Read the spin hint message guide to learn more about hint customization.

Multi-language​

You can display text in different languages when necessary. Create a profile for each language you wish to provide. Each profile can contain different UI messages (e.g. Swipe to spin) or button alt text (e.g. Fullscreen). Once you've created your profiles, one for each language, serve the profile for the language the customer requires. For example, if you named your profile "spin-spanish", append it to the URL like this:

https://demo.sirv.com/drill/drill.spin?profile=spin-spanish

Context menu​

A context menu can be shown on right-click. It provides all the usual browser options, such as "Save image". The menu is hidden by default. Show it by setting rightClick to true: https://demo.sirv.com/drill/drill.spin?rightClick=true Right-click this spin to see the menu:

3

Text overlays​

You can overlay text or image layers over your spins to display things like product names, copyright information or logo watermarks. Apply text overlays either by creating a profile or editing the .spin file. As a rule, a profile is best because it permits you to apply the same settings to multiple spins. For example, here's a Sirv spin with a text profile:

4

First image in a spin​

Sirv has a thumb parameter that automatically serves the first image in a spin. This image will always match the image the user sees when the spin loads. The thumbnail can be any size, as well as have any of the Sirv dynamic imaging settings applied to it. To fetch the first image of a Sirv spin, enter ?thumb after the .spin reference, for example: https://demo.sirv.com/drill/drill.spin?thumb Resize the image with the usual Sirv dynamic imaging options like so: https://demo.sirv.com/drill/drill.spin?thumb&w=200 Thumbnail image at 200px width Apply any other Sirv dynamic imaging settings as you wish, e.g.: https://demo.sirv.com/drill/drill.spin?thumb&w=200&text=360&text.color=black&text.position=center&text.size=90&text.opacity=70&text.outline.width=4&text.outline.color=white&text.outline.blur=2 Thumbnail image with text overlay By default, the first image is column 1. In case of a 3D spin, the first image is column 1, row 1. To choose another image, right-click the spin, choose "Edit" and pick a different start row and start column:

0

Styling​

Loading bar​

A loading bar shows the overall image download progress.

Change the text of the loading message from "Loading..." by applying the loadingText option. For example: https://demo.sirv.com/bed/bed.spin?loadingText=Here%20comes%20the%20spin!

1

Fullscreen spins say "Loading large spin...". Use the fullscreenLoadingText option to change the text, for example:

https://demo.sirv.com/ring/ring.spin?fullscreenLoadingText=Wait%20for%20it! The position, animation and design of the loading bar can be customized by changing these styles:


.sirv-spin-loading {}
.sirv-spin-progress-bar {}
.sirv-spin-progress-bar-state {}
.sirv-spin-progress-text {}
.sirv-spin-fullscreen .sirv-spin-loading-box {}
.sirv-spin-fullscreen .sirv-spin-progress-bar {}
.sirv-spin-fullscreen .sirv-spin-progress-bar-state {}
.sirv-spin-fullscreen .sirv-spin-progress-text {}

Visit the spin loading bar guide for more information.

Fullscreen background​

The enlarged fullscreen spin has a white background by default. You can change the background color with the CSS style sirv-spin-fullscreen. For example, to change the background to black, add the following CSS code to your HTML page:For a more detailed example, please read this guide.

Fullscreen button​

The default fullscreen buttons look like this: Fullscreen buttons Design your own buttons, with the same dimensions as the original buttons above. For example:

2 Upload your buttons to any directory in your Sirv account, then add the following CSS to your page:For a full list of available options, visit this article.

Zoom cursors​

Sirv uses two cursors to zoom in and zoom out of spins: Default zoom in cursor