KeyShotXR Variables

Below is a list of KeyShotXR variables. these variables are set in the .html file created by KeyShot Studio when the KeyShotXR is rendered. These variables can be edited after the KeyShotXR is created if minor edits are needed, rather than recreating the KeyShotXR over again. The .html file can be edited using a standard text editor.

Variable Location

All KeyShot Studio variables are located in the KeyShotXR .html file <head> section, within a <script> tag, and are called by the initKeyShotXR() function.

Variable location

<head>  <script type="text/javascript">    var keyshotXR;
 
    function initKeyShotXR() {
      var nameOfDiv = "KeyShotXR";
      // Other variables follow here..
 
      keyshotXR = new keyshotXR(nameOfDiv, /* The other variables ... */);
    }
 
    window.onload = initKeyShotXR;
  </script></head>
nameOfDiv

The div id of the KeyShotXR. This is where the KeyShotXR content is located.

Position in html

<body oncontextmenu="return false;">  <div id="KeyShotXR"></div></body>

Variables

General Settings

Folder Name – folderName

The name of the folder that contains all the files for the KeyShotXR. This is set under Render, Output options in the KeyShotXR tab, Name entry.

Usage Example:

var folderName = "material_ball_XR.10";
Download only on click – downloadOnInteraction

This variable allows a KeyShotXR only to be loaded after it has been clicked. This option is set in the KeyShotXR settings, under RenderOutput options in the KeyShotXR tab, under Advanced.

Usage Example:

var downloadOnInteraction = false;
Image type – imageExtension

This variable is the image extension for the frames generated for the KeyShotXR. Only one extension type may be used. This is set in the KeyShotXR settings, under Render, Output options in the KeyShotXR tab, under KeyShotXR Control > Format.

Usage Example:

var imageExtension = "jpg";
Background color – backgroundColor

The background color of the .html page in hexidecimal notation. This will be the color behind/surrounding the KeyShotXR. The default is white (#FFFFFF). This option can only be set from in the .html file.

Usage Example:

var backgroundColor = "#FFFFFF";

Frame number

Horizontal – uCount

This is the number of horizontal frames in the KeyShotXR. This is set under Render, Output options in the KeyShotXR tab, under KeyShotXR Control > Smoothness Control.

Usage Example:

var uCount = 18;
Vertical – vCount

This is the number of vertical frames in the KeyShotXR. This is set under Render, Output options in the KeyShotXR tab, under KeyShotXR Control > Smoothness Control.

Usage Example:

var vCount = 18;

Start Frame

Horizontal – uStartIndex

This controls the horizontal start frame for the KeyShotXR. This is set by viewing angle in the KeyShotXR settings, under Render, Output options in the KeyShotXR tab, under KeyShotXR Control > Angle Control.

Usage Example:

var uStartIndex = 1;
Vertical – vStartIndex

This controls the vertical start frame for the KeyShotXR. This is set by viewing angle in the KeyShotXR settings, under Render, Output options in the KeyShotXR tab, under KeyShotXR Control > Angle Control.

Usage Example:

var vStartIndex = 0;

ViewPort Size

Width – viewPortWidth

The width of the KeyShotXR in pixels. This is set under RenderOutput options in the KeyShotXR tab, Viewing Resolution > first text field entry.

Usage Example:

var viewPortWidth = 640;
Height – viewPortHeight

The height of the KeyShotXR in pixels. This is set under Render >  Output options in the KeyShotXR tab, Viewing Resolution > second text field entry.

Usage Example:

var viewPortHeight = 640;

Rotation settings

Continuous horizontal rotation – uWrap

This allows the KeyShotXR to continue rotation after last frame in the horizontal direction when set to true.

Usage Example:

var uWrap = true;
Continuous vertical rotation – vWrap

This allows the KeyShotXR to continue rotation after last frame in the vertical direction when set to true.

Usage Example:

var vWrap = true;
Rotation damping – rotationDamping

This controls the speed at which the rotation slows down when a KeyShotXR is rotated. Increasing this value will increase the duration of rotation before coming to a stop. This is set in the KeyShotXR settings, under Render > Output options in the KeyShotXR tab, under Advanced.

Usage Example:

var rotationDamping = 0.96;

Mouse Sensitivity

Horizontal – uMouseSensitivity

This controls the horizontal mouse/touch sensitivity for the KeyShotXR. Changing the value to/from a negative value will change the direction of the KeyShotXR rotation. This is set under Render > Output options in the KeyShotXR tab, under Advanced.

Usage Example:

var uMouseSensitivity = -0.0055;
Vertical – vMouseSensitivity

This controls the vertical mouse/touch sensitivity for the KeyShotXR. Changing the value to/from a negative value will change the direction of the KeyShotXR rotation. This is set under RenderOutput options in the KeyShotXR tab, under Advanced.

Usage Example:

var vMouseSensitivity = 1;

Zoom levels

Minimum – minZoom

This controls the minimum zoom level for the KeyShotXR. Setting to a negative value will allow Zoom out capability. Increasing the value above 1 will change the zoom level of the KeyShotXR when loaded. This is set in the KeyShotXR settings, under RenderOutput options in the KeyShotXR tab, under Advanced by checking the Zoom-In checkbox.

Usage Example:

var minZoom = 1;
Note

KeyShot Studio automatically calculates the resolution when rendering the KeyShotXR based on this setting when ‘Preserve image quality’ option is enabled. If changed afterward, grainy images may be experienced.

Maximum – maxZoom

This controls the maximum zoom level for the KeyShotXR. Increasing this number, increases the amount a KeyShotXR can be zoomed in. This is set in the KeyShotXR settings, under Render > Output options in the KeyShotXR tab, under Advanced by checking the Zoom-In checkbox.

Usage Example:

var maxZoom = 1;
Note

KeyShot Studio automatically calculates the resolution when rendering the KeyShotXR based on this setting when ‘Preserve image quailty’ option is enabled. If changed afterward, grainy images may be experienced.

Loading icon

Show loading icon – showLoading

If this variable is set to true, the loading icon will be shown. If set to false, it will not be shown. This option is set in the KeyShotXR settings, under Render, Output options in the KeyShotXR tab, under Advanced  by selecting the Show Loading Screen option.

Usage Example:

var showLoading = true;
Set loading icon – loadingIcon

This allows a different loading icon to be used. The variable is the filename of the icon located in the the KeyShotXR files folder. This option is set in the KeyShotXR settings, under RenderOutput options in the KeyShotXR tab, under Advanced, by selecting the Default loading icon.

Usage Example:

var loadingIcon = "ks_logo.png";

Screen size

Automatic resizing (responsive size) – downScaleToBrowser

This variable controls the automatic resizing of a KeyShotXR when a browser is resized; it allows a KeyShotXR to be responsive. This is set to true by default and can only be changed in the .html file. 

Usage Example:

var downScaleToBrowser = true;
Allow full screen – allowFullscreen

This variable allows a KeyShotXR to be viewed fullscreen when it is double-clicked in desktop browsers. This option is set in the KeyShotXR settings, under Render, Output options in the KeyShotXR tab, under Advanced, by selecting Allow Fullscreen Mode by Double-Click.

Usage Example:

var allowFullscreen = true;

Move Direction

Reverse horizontal direction – uReverse

This variable will reverse the horizontal direction of rotation when set to true.

Usage Example:

var uReverse = false;
Reverse vertical direction – vReverse

This variable will reverse the vertical direction of rotation when set to true.

Usage Example:

var vReverse = false;

Deprecated variables

addDownScaleGUIButton

With KeyShot 6 this option has been deprecated. The option is still available for legacy KeyShotXRs that require this from in the .html file.

Usage Example:

var addDownScaleGUIButton = false;