How to use the @microsoft/mixed-reality-extension-sdk.TextAnchorLocation function in @microsoft/mixed-reality-extension-sdk

To help you get started, we’ve selected a few @microsoft/mixed-reality-extension-sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / mixed-reality-extension-sdk-samples / samples / wear-a-hat / src / app.ts View on Github external
local: { position: { x: 0.5, y, z: 0 } }
                    }
                }
            });
            y = y + 0.5;
        }

        // Create a label for the menu title.
        MRESDK.Actor.CreateEmpty(this.context, {
            actor: {
                parentId: menu.id,
                name: 'label',
                text: {
                    contents: ''.padStart(8, ' ') + "Wear a Hat",
                    height: 0.8,
                    anchor: MRESDK.TextAnchorLocation.MiddleCenter,
                    color: MRESDK.Color3.Yellow()
                },
                transform: {
                    local: { position: { x: 0.5, y: y + 0.25, z: 0 } }
                }
            }
        });
    }
github microsoft / mixed-reality-extension-sdk-samples / samples / wear-a-hat / src / app.ts View on Github external
}
            });

            // Set a click handler on the button.
            button.value.setBehavior(MRESDK.ButtonBehavior)
                .onClick('released', user => this.wearHat(hatId, user.id));

            // Create a label for the menu entry.
            MRESDK.Actor.CreateEmpty(this.context, {
                actor: {
                    parentId: menu.id,
                    name: 'label',
                    text: {
                        contents: HatDatabase[hatId].displayName,
                        height: 0.5,
                        anchor: MRESDK.TextAnchorLocation.MiddleLeft
                    },
                    transform: {
                        local: { position: { x: 0.5, y, z: 0 } }
                    }
                }
            });
            y = y + 0.5;
        }

        // Create a label for the menu title.
        MRESDK.Actor.CreateEmpty(this.context, {
            actor: {
                parentId: menu.id,
                name: 'label',
                text: {
                    contents: ''.padStart(8, ' ') + "Wear a Hat",
github microsoft / mixed-reality-extension-sdk / packages / functional-tests / src / app.ts View on Github external
geometry: { shape: 'auto' }
				}
			}
		});
		const label = MRE.Actor.Create(this.context, {
			actor: {
				parentId: this.exclusiveUserToggle.id,
				transform: {
					local: {
						position: { x: 0.3 }
					}
				},
				text: {
					contents: this.exclusiveUser ? `Exclusive to:\n${this.exclusiveUser.name}` : "Inclusive",
					height: 0.2,
					anchor: MRE.TextAnchorLocation.MiddleLeft
				}
			}
		});
		this.exclusiveUserLabel = label.text;

		this.exclusiveUserToggle.setBehavior(MRE.ButtonBehavior)
			.onButton('released', user => this.toggleExclusiveUser(user));

		const floor = MRE.Actor.Create(this.context, {
			actor: {
				name: 'floor',
				appearance: {
					meshId: this.assets.createBoxMesh('floor', 2, 0.1, 2.1 ).id,
					materialId: this.backgroundMaterial.id
				},
				transform: {
github microsoft / mixed-reality-extension-sdk / packages / functional-tests / src / app.ts View on Github external
collider: { geometry: { shape: 'auto' } }
			}
		});

		this.playPauseText = MRE.Actor.Create(this.context, {
			actor: {
				parentId: this.playPauseButton.id,
				transform: {
					local: {
						position: { z: -0.1 }
					}
				},
				text: {
					contents: "Start",
					height: 0.15,
					anchor: MRE.TextAnchorLocation.MiddleCenter,
					justify: MRE.TextJustify.Center,
					color: NeutralColor
				}
			}
		});

		this.playPauseButton.setBehavior(MRE.ButtonBehavior)
			.onButton("released", user => {
				if (this.activeTest === null) {
					this.runTest(user);
				} else {
					this.stopTest().catch(() => { });
				}
			});

		const menuButton = MRE.Actor.Create(this.context, {
github microsoft / mixed-reality-extension-sdk / packages / functional-tests / src / menu.ts View on Github external
}
		});

		const backLabel = MRE.Actor.Create(this.context, {
			actor: {
				name: 'BackLabel',
				parentId: backButton.id,
				transform: {
					local: {
						position: { x: buttonWidth * 1.2, z: 0.05 }
					},
				},
				text: {
					contents: "Back",
					height: 0.2,
					anchor: MRE.TextAnchorLocation.MiddleLeft
				}
			}
		});

		backButton.setBehavior(MRE.ButtonBehavior)
			.onButton('released', () => {
				this.back();
				this.show();
			});

		this.otherActors = [backButton, backLabel];
	}
github microsoft / mixed-reality-extension-sdk-samples / samples / solar-system / src / app.ts View on Github external
colliderType: 'sphere',
                actor: {
                    name: `${bodyName}-body`,
                    parentId: obliquity1.value.id,
                    transform: {
                        scale: scaleValue
                    }
                }
            });

            label.value.enableText({
                contents: bodyName,
                height: 0.5,
                pixelsPerLine: 50,
                color: MRESDK.Color3.Yellow(),
                anchor: MRESDK.TextAnchorLocation.TopCenter,
                justify: MRESDK.TextJustify.Center,
            });

            setTimeout(() => {
                label.value.text.color = MRESDK.Color3.White();
            }, 5000);

            this.celestialBodies[bodyName] = {
                inclination: inclination.value,
                position: position.value,
                obliquity0: obliquity0.value,
                obliquity1: obliquity1.value,
                model: model.value
            } as CelestialBody;

            this.createAnimations(bodyName);
github microsoft / mixed-reality-extension-sdk-samples / samples / solar-system / src / app.ts View on Github external
actor: {
                    name: `${bodyName}-body`,
                    parentId: obliquity1.value.id,
                    transform: {
                        local: { scale: scaleValue }
                    }
                }

            });

            label.value.enableText({
                contents: bodyName,
                height: 0.5,
                pixelsPerLine: 50,
                color: MRESDK.Color3.Yellow(),
                anchor: MRESDK.TextAnchorLocation.TopCenter,
                justify: MRESDK.TextJustify.Center,
            });

            setTimeout(() => {
                label.value.text.color = MRESDK.Color3.White();
            }, 5000);

            this.celestialBodies[bodyName] = {
                inclination: inclination.value,
                position: position.value,
                obliquity0: obliquity0.value,
                obliquity1: obliquity1.value,
                model: model.value
            } as CelestialBody;

            this.createAnimations(bodyName);

@microsoft/mixed-reality-extension-sdk

The Mixed Reality Extension SDK enables developers to build 3D world extensions for AltspaceVR, using Node.JS.

MIT
Latest version published 4 years ago

Package Health Score

48 / 100
Full package analysis