Index: chrome/browser/resources/vr_shell/vr_shell_ui_api.js |
diff --git a/chrome/browser/resources/vr_shell/vr_shell_ui_api.js b/chrome/browser/resources/vr_shell/vr_shell_ui_api.js |
index 967de17057397527263f8bf84fcb66a9f83aa3fa..bc1709cd4bd3ff9a34600aa25d5b4e42db934e23 100644 |
--- a/chrome/browser/resources/vr_shell/vr_shell_ui_api.js |
+++ b/chrome/browser/resources/vr_shell/vr_shell_ui_api.js |
@@ -24,7 +24,9 @@ api.Command = { |
* @param {Array<Object>} commands |
*/ |
api.sendCommands = function(commands) { |
- chrome.send('updateScene', commands); |
+ if (commands.length > 0) { |
+ chrome.send('updateScene', commands); |
+ } |
}; |
/** |
@@ -214,12 +216,21 @@ api.UiElementUpdate = class { |
/** |
* Causes an element to be rendered relative to the field of view, rather |
- * than the scene. Elements locked in this way should not have a parent. |
+ * than the scene. Elements locked in this way should not have a parent. |
* @param {boolean} locked |
*/ |
setLockToFieldOfView(locked) { |
this.properties['lockToFov'] = !!locked; |
} |
+ |
+ /** |
+ * Causes an element to be rendered with a specified opacity, between 0.0 and |
+ * 1.0. Opacity is inherited by children. |
+ * @param {number} opacity |
+ */ |
+ setOpacity(opacity) { |
+ this.properties['opacity'] = opacity; |
+ } |
}; |
/** |
@@ -257,7 +268,8 @@ api.Property = { |
'SIZE': 1, |
'TRANSLATION': 2, |
'SCALE': 3, |
- 'ROTATION': 4 |
+ 'ROTATION': 4, |
+ 'OPACITY': 5 |
}; |
/** |
@@ -359,4 +371,13 @@ api.Animation = class { |
this.to.y = y; |
this.to.z = z; |
} |
+ |
+ /** |
+ * Set the animation's final element opacity. |
+ * @param {number} opacity |
+ */ |
+ setOpacity(opacity) { |
+ this.property = api.Property.OPACITY; |
+ this.to.x = opacity; |
+ } |
}; |