Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
transform: {
local: {
position: { x: 0, y: -1, z: 0 },
scale: { x: 0.4, y: 0.4, z: 0.4 }
}
}
}
});
// Grab that early reference again.
this.cube = cubePromise.value;
// Create some animations on the cube.
this.cube.createAnimation(
'DoAFlip', {
keyframes: this.generateSpinKeyframes(1.0, Vector3.Right()),
events: []
});
// Now that the text and its animation are all being set up, we can start playing
// the animation.
this.text.enableAnimation('Spin');
// Set up cursor interaction. We add the input behavior ButtonBehavior to the cube.
// Button behaviors have two pairs of events: hover start/stop, and click start/stop.
const buttonBehavior = this.cube.setBehavior(ButtonBehavior);
// Trigger the grow/shrink animations on hover.
buttonBehavior.onHover('enter', () => {
this.cube.animateTo(
{ transform: { local: { scale: { x: 0.5, y: 0.5, z: 0.5 } } } }, 0.3, AnimationEaseCurves.EaseOutSine);
});
// Parent the glTF model to the text actor.
parentId: this.text.id,
transform: {
position: { x: 0, y: -1, z: 0 },
scale: { x: 0.4, y: 0.4, z: 0.4 }
}
}
});
// Grab that early reference again.
this.cube = cubePromise.value;
// Create some animations on the cube.
this.cube.createAnimation(
'DoAFlip', {
keyframes: this.generateSpinKeyframes(1.0, Vector3.Right()),
events: []
});
// Now that the text and its animation are all being set up, we can start playing
// the animation.
this.text.enableAnimation('Spin');
// Set up cursor interaction. We add the input behavior ButtonBehavior to the cube.
// Button behaviors have two pairs of events: hover start/stop, and click start/stop.
const buttonBehavior = this.cube.setBehavior(ButtonBehavior);
// Trigger the grow/shrink animations on hover.
buttonBehavior.onHover('enter', (userId: string) => {
this.cube.animateTo(
{ transform: { scale: { x: 0.5, y: 0.5, z: 0.5 } } }, 0.3, AnimationEaseCurves.EaseOutSine);
});
// Create some animations on the cube.
cube.createAnimation(
'GrowIn', {
keyframes: this.growAnimationData,
events: []
});
cube.createAnimation(
'ShrinkOut', {
keyframes: this.shrinkAnimationData,
events: []
});
cube.createAnimation(
'DoAFlip', {
keyframes: this.generateSpinKeyframes(1.0, Vector3.Right()),
events: []
});
// Set up cursor interaction. We add the input behavior ButtonBehavior to the cube.
// Button behaviors have two pairs of events: hover start/stop, and click start/stop.
const buttonBehavior = cube.setBehavior(ButtonBehavior);
// Trigger the grow/shrink animations on hover.
buttonBehavior.onHover('enter', () => {
if (this.gameState === GameState.Play &&
this.boardState[tileIndexX * 3 + tileIndexZ] === undefined) {
cube.enableAnimation('GrowIn');
}
});
buttonBehavior.onHover('exit', () => {
if (this.gameState === GameState.Play &&