Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
});
// Even though the actor is not yet created in Altspace (because we didn't wait for the promise),
// we can still get a reference to it by grabbing the `value` field from the forward promise.
this.text = textPromise.value;
this.light = lightPromise.value;
// Here we create an animation on our text actor. Animations have three mandatory arguments:
// a name, an array of keyframes, and an array of events.
this.textAnchor.createAnimation(
// The name is a unique identifier for this animation. We'll pass it to "startAnimation" later.
"Spin", {
// Keyframes define the timeline for the animation: where the actor should be, and when.
// We're calling the generateSpinKeyframes function to produce a simple 20-second revolution.
keyframes: this.generateSpinKeyframes(20, Vector3.Up()),
// Events are points of interest during the animation. The animating actor will emit a given
// named event at the given timestamp with a given string value as an argument.
events: [],
// Optionally, we also repeat the animation infinitely.
wrapMode: AnimationWrapMode.Loop
});
for (let tileIndexX = 0; tileIndexX < 3; tileIndexX++) {
for (let tileIndexZ = 0; tileIndexZ < 3; tileIndexZ++) {
// Load a glTF model
const cubePromise = Actor.CreateFromGLTF(this.context, {
// at the given URL
resourceUrl: `${this.baseUrl}/altspace-cube.glb`,
// and spawn box colliders around the meshes.
colliderType: 'box',
}
}
});
// Even though the actor is not yet created in Altspace (because we didn't wait for the promise),
// we can still get a reference to it by grabbing the `value` field from the forward promise.
this.text = textPromise.value;
// Here we create an animation on our text actor. Animations have three mandatory arguments:
// a name, an array of keyframes, and an array of events.
this.text.createAnimation(
// The name is a unique identifier for this animation. We'll pass it to "startAnimation" later.
"Spin", {
// Keyframes define the timeline for the animation: where the actor should be, and when.
// We're calling the generateSpinKeyframes function to produce a simple 20-second revolution.
keyframes: this.generateSpinKeyframes(20, Vector3.Up()),
// Events are points of interest during the animation. The animating actor will emit a given
// named event at the given timestamp with a given string value as an argument.
events: [],
// Optionally, we also repeat the animation infinitely. PingPong alternately runs the animation
// foward then backward.
wrapMode: AnimationWrapMode.PingPong
});
// Load a glTF model
const cubePromise = Actor.CreateFromGLTF(this.context, {
// at the given URL
resourceUrl: `${this.baseUrl}/altspace-cube.glb`,
// and spawn box colliders around the meshes.
colliderType: 'box',
// Also apply the following generic actor properties.
}
}
});
// Even though the actor is not yet created in Altspace (because we didn't wait for the promise),
// we can still get a reference to it by grabbing the `value` field from the forward promise.
this.text = textPromise.value;
// Here we create an animation on our text actor. Animations have three mandatory arguments:
// a name, an array of keyframes, and an array of events.
this.text.createAnimation(
// The name is a unique identifier for this animation. We'll pass it to "startAnimation" later.
"Spin", {
// Keyframes define the timeline for the animation: where the actor should be, and when.
// We're calling the generateSpinKeyframes function to produce a simple 20-second revolution.
keyframes: this.generateSpinKeyframes(20, Vector3.Up()),
// Events are points of interest during the animation. The animating actor will emit a given
// named event at the given timestamp with a given string value as an argument.
events: [],
// Optionally, we also repeat the animation infinitely. PingPong alternately runs the animation
// foward then backward.
wrapMode: AnimationWrapMode.PingPong
});
// Load a glTF model
const cubePromise = Actor.CreateFromGLTF(this.context, {
// at the given URL
resourceUrl: `${this.baseUrl}/altspace-cube.glb`,
// and spawn box colliders around the meshes.
colliderType: 'box',
// Also apply the following generic actor properties.