Browse Source

autoStart can be boolean.
if set to true, the first animation will be triggered.

Raanan Weber 7 years ago
parent
commit
2db3f919e9
2 changed files with 4 additions and 2 deletions
  1. 1 1
      Viewer/src/configuration/configuration.ts
  2. 3 1
      Viewer/src/model/viewerModel.ts

+ 1 - 1
Viewer/src/configuration/configuration.ts

@@ -86,7 +86,7 @@ export interface IModelConfiguration {
     thumbnail?: string; // URL or data-url
 
     animation?: {
-        autoStart?: string;
+        autoStart?: boolean | string;
         playOnce?: boolean;
     }
 

+ 3 - 1
Viewer/src/model/viewerModel.ts

@@ -96,7 +96,9 @@ export class ViewerModel implements IDisposable {
                     });
                 }
                 if (this._modelConfiguration.animation.autoStart) {
-                    let animation = this.getAnimationByName(this._modelConfiguration.animation.autoStart);
+
+                    let animation = this._modelConfiguration.animation.autoStart === true ?
+                        this._animations[0] : this.getAnimationByName(this._modelConfiguration.animation.autoStart);
                     if (animation) {
                         animation.start();
                     }