UNPKG

@needle-tools/engine

Version:

Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.

59 lines (58 loc) 1.83 kB
import { Texture } from 'three'; import { MaskableGraphic } from './Graphic.js'; declare class Sprite { texture: Texture | null; rect?: { width: number; height: number; }; } /** * [Image](https://engine.needle.tools/docs/api/Image) displays a sprite (2D texture) in the UI. Can be used for icons, * backgrounds, or any visual element that needs a texture. * * **Properties:** * - `image` - Direct texture assignment (convenience property) * - `sprite` - Sprite object containing texture and rect info * - `color` - Tint color applied to the image (inherited from Graphic) * * **Usage with Button:** * Image is commonly paired with {@link Button} to create clickable * UI elements with visual feedback via color tinting. * * @example Set an image texture * ```ts * const img = myIcon.getComponent(Image); * img.image = myTexture; * img.color = new RGBAColor(1, 0.5, 0.5, 1); // Red tint * ``` * * @summary Display a 2D image in the UI * @category User Interface * @group Components * @see {@link Canvas} for the UI root * @see {@link Button} for clickable images * @see {@link RawImage} for non-UI image display */ export declare class Image extends MaskableGraphic { set image(img: Texture | null); get image(): Texture | null; get sprite(): Sprite | undefined; set sprite(sprite: Sprite | undefined); private _sprite?; private pixelsPerUnitMultiplier; private isBuiltinSprite; protected onBeforeCreate(opts: any): void; protected onAfterCreated(): void; } /** * @category User Interface * @group Components */ export declare class RawImage extends MaskableGraphic { get mainTexture(): Texture | undefined; set mainTexture(texture: Texture | undefined); private _mainTexture?; protected onAfterCreated(): void; } export {};