Created
February 21, 2025 04:21
-
-
Save skang2-sc/ec2048df8af1a70c512a254b87a5e745 to your computer and use it in GitHub Desktop.
ToggleImage with Spectacles Interaction Kit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { PinchButton } from "SpectaclesInteractionKit/Components/UI/PinchButton/PinchButton"; | |
@component | |
export class ToggleImage extends BaseScriptComponent { | |
@input | |
image: Image; | |
onAwake() { | |
this.sceneObject | |
.getComponent(PinchButton.getTypeName()) | |
.onButtonPinched.add(() => { | |
this.toggleImage(); | |
}); | |
} | |
toggleImage() { | |
this.image.enabled = !this.image.enabled; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment