Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
text: {
contents: "Tic-Tac-Toe!",
anchor: TextAnchorLocation.MiddleCenter,
color: { r: 30 / 255, g: 206 / 255, b: 213 / 255 },
height: 0.3
},
}
});
const lightPromise = Actor.CreateEmpty(this.context, {
actor: {
parentId: textPromise.value.id,
name: 'Light',
transform: {
local: {
position: { x: 0, y: 1.0, z: -0.5 },
rotation: Quaternion.RotationAxis(Vector3.Left(), -45.0 * DegreesToRadians),
}
},
light: {
color: { r: 1, g: 0.6, b: 0.3 },
type: 'spot',
intensity: 20,
range: 6,
spotAngle: 45 * DegreesToRadians
},
}
});
// 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;
private generateSpinKeyframes(duration: number, axis: Vector3): AnimationKeyframe[] {
return [{
time: 0 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, 0) } } }
}, {
time: 0.25 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, Math.PI / 2) } } }
}, {
time: 0.5 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, Math.PI) } } }
}, {
time: 0.75 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, 3 * Math.PI / 2) } } }
}, {
time: 1 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, 2 * Math.PI) } } }
}];
}
}
private generateSpinKeyframes(duration: number, axis: Vector3): AnimationKeyframe[] {
return [{
time: 0 * duration,
value: { transform: { rotation: Quaternion.RotationAxis(axis, 0) } }
}, {
time: 0.25 * duration,
value: { transform: { rotation: Quaternion.RotationAxis(axis, Math.PI / 2) } }
}, {
time: 0.5 * duration,
value: { transform: { rotation: Quaternion.RotationAxis(axis, Math.PI) } }
}, {
time: 0.75 * duration,
value: { transform: { rotation: Quaternion.RotationAxis(axis, 3 * Math.PI / 2) } }
}, {
time: 1 * duration,
value: { transform: { rotation: Quaternion.RotationAxis(axis, 2 * Math.PI) } }
}];
}
}
private generateSpinKeyframes(duration: number, axis: Vector3): AnimationKeyframe[] {
return [{
time: 0 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, 0) } } }
}, {
time: 0.25 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, Math.PI / 2) } } }
}, {
time: 0.5 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, Math.PI) } } }
}, {
time: 0.75 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, 3 * Math.PI / 2) } } }
}, {
time: 1 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, 2 * Math.PI) } } }
}];
}
private generateSpinKeyframes(duration: number, axis: Vector3): AnimationKeyframe[] {
return [{
time: 0 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, 0) } } }
}, {
time: 0.25 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, Math.PI / 2) } } }
}, {
time: 0.5 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, Math.PI) } } }
}, {
time: 0.75 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, 3 * Math.PI / 2) } } }
}, {
time: 1 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, 2 * Math.PI) } } }
}];
}
}
private generateSpinKeyframes(duration: number, axis: Vector3): AnimationKeyframe[] {
return [{
time: 0 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, 0) } } }
}, {
time: 0.25 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, Math.PI / 2) } } }
}, {
time: 0.5 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, Math.PI) } } }
}, {
time: 0.75 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, 3 * Math.PI / 2) } } }
}, {
time: 1 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, 2 * Math.PI) } } }
}];
}
private generateSpinKeyframes(duration: number, axis: Vector3): AnimationKeyframe[] {
return [{
time: 0 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, 0) } } }
}, {
time: 0.25 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, Math.PI / 2) } } }
}, {
time: 0.5 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, Math.PI) } } }
}, {
time: 0.75 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, 3 * Math.PI / 2) } } }
}, {
time: 1 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, 2 * Math.PI) } } }
}];
}
}
private generateSpinKeyframes(duration: number, axis: Vector3): AnimationKeyframe[] {
return [{
time: 0 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, 0) } } }
}, {
time: 0.25 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, Math.PI / 2) } } }
}, {
time: 0.5 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, Math.PI) } } }
}, {
time: 0.75 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, 3 * Math.PI / 2) } } }
}, {
time: 1 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, 2 * Math.PI) } } }
}];
}
}
private generateSpinKeyframes(duration: number, axis: Vector3): AnimationKeyframe[] {
return [{
time: 0 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, 0) } } }
}, {
time: 0.25 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, Math.PI / 2) } } }
}, {
time: 0.5 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, Math.PI) } } }
}, {
time: 0.75 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, 3 * Math.PI / 2) } } }
}, {
time: 1 * duration,
value: { transform: { local: { rotation: Quaternion.RotationAxis(axis, 2 * Math.PI) } } }
}];
}