원클릭으로
lens-studio-snap-decorators
Use TypeScript decorators to bind lifecycle events and inject dependencies declaratively.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Use TypeScript decorators to bind lifecycle events and inject dependencies declaratively.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | lens-studio-snap-decorators |
| description | Use TypeScript decorators to bind lifecycle events and inject dependencies declaratively. |
The SnapDecorators package provides a set of TypeScript decorators that eliminate boilerplate code for event binding and component lookups. Instead of manually creating events in onAwake, you can use declarative annotations on your class methods and properties.
Use decorators to bind methods directly to Lens Studio lifecycle events.
import {
bindStartEvent,
bindUpdateEvent,
bindDestroyEvent
} from "SnapDecorators.lspkg/decorators";
@component
export class MyAdvancedScript extends BaseScriptComponent {
@bindStartEvent
onStart() {
print("Lens started!");
}
@bindUpdateEvent
onUpdate() {
// Runs every frame
}
@bindDestroyEvent
onCleanup() {
print("Component destroyed");
}
}
Avoid repeated getComponent calls by using @depends and @provider.
import { depends, provider } from "SnapDecorators.lspkg/decorators";
@component
export class MyController extends BaseScriptComponent {
// Injects a component found on the same SceneObject
@depends("Component.RenderMeshVisual")
mesh!: RenderMeshVisual;
// Injects a component found on this object or any parent object
@provider("Component.Camera")
camera!: Camera;
@bindStartEvent
init() {
print("Found camera: " + this.camera.getSceneObject().name);
}
}
The @memo decorator caches the result of a getter the first time it is accessed.
import { memo } from "SnapDecorators.lspkg/decorators";
@component
export class DataProcessor extends BaseScriptComponent {
@memo
get expensiveCalculation() {
print("Running heavy math...");
return Math.sqrt(Math.random() * 1000);
}
}
The code logic below is extracted from the official SnapDecorators.lspkg package, providing the implementation of the decorators themselves.
See the reference guide for details.
Reference guide for 2D UI and screen-space interaction in Lens Studio — covering ScreenTransform anchors/offsets/size/pivot and coordinate conversions (localPointToScreenPoint, screenPointToLocalPoint, localPointToWorldPoint), ScreenImage (texture, stretch mode, color tint), Text component (content, font, alignment, color, size), ScreenRegionComponent for defining tap/touch areas, TouchComponent with TouchStartEvent/TouchMoveEvent/TouchEndEvent, tap input for phone lenses, LSTween UI animations (colorTo, moveTo on screen elements), multi-swatch color picker pattern, undo stack pattern, and common gotchas. Use this skill whenever a lens needs a 2D UI panel, tap interaction, on-screen buttons, text labels, color pickers, swipeable menus, or undo/redo — covering Drawing, Quiz, TappableQuestion, MemeSticker, MusicVideo, and HighScore examples.
Learn how to programmatically request and manage raw camera textures and crops.
Reference guide for face and body AR tracking in Lens Studio — covering FaceTrackingComponent setup (multi-face, faceIndex), FaceInset and FaceMask effects, 2D and 3D Face Attachments (hat/mouth/left_eye/right_eye anchors), Face Mesh UV texturing, Face Landmarks (68 keypoints), Face Expression weights for mouth-open/eye-blink detection, Eye Tracking component (left/right eye direction), Upper Body Tracking 3D asset (hips/spine/shoulder attachment points), Upper Body Mesh for seamless selfie occlusion, and Face Retouch/Eye Color/Face Liquify/Face Stretch effects. Use this skill for any phone or front-camera lens involving faces, selfie effects, makeup, face masks, 3D head ornaments, body tracking, or expression-driven animations — covering the vast majority of Snapchat lens content.
Learn how to dynamically instantiate prefabs algorithmically in grid or spherical patterns.
Implement proximity-based triggers and smooth tethering behaviors for interactive objects.
Learn how to track image markers and detach the tracked content into World Space in AR.