# Class Sticker

贴纸

#### Hierarchy

- Mesh<THREE.BufferGeometry, THREE.MeshBasicMaterial>
  - Sticker

- Defined in lib/sticker/index.ts:75

##### Index

### Constructors

constructor

### Accessors

needsRender
version

### Methods

dispose
locationWithIntersection
setSize
setTransparent

## Constructors

### constructor

- new Sticker(
  width: number,
  height: number,
  resource: string | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement,
  ): Sticker

  贴纸

  #### Parameters

  - width: number

    贴纸长

  - height: number

    贴纸宽

  - resource: string | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement

    贴纸图片地址 或者 image / canvas / video 标签

  #### Returns Sticker

  #### Description

  默认加载时, 透明图根据图片类型，如果是 png 默认透明，其他为不透明，且不支持 gif 动画。

  #### Example

      const resource = "https://vr-public.realsee-cdn.cn/release/static/image/release/five/demo/sticker/kagami.jpg";
      five.on("wantsTapGesture", raycaster => {
        const [intersection] = five.model.intersectRaycaster(raycaster);
        if (intersection) {
          const sticker = new Sticker(1, 1, resource);
          five.scene.add(sticker);
          sticker.locationWithIntersection(intersection);
        }
        return false;
      });

  Overrides THREE.Mesh<THREE.BufferGeometry, THREE.MeshBasicMaterial>.constructor

  - Defined in lib/sticker/index.ts:106

## Accessors

### needsRender

- get needsRender(): boolean

  #### Returns boolean

  - Defined in lib/sticker/index.ts:151
- set needsRender(value: boolean): void

  #### Parameters

  - value: boolean

  #### Returns void

  - Defined in lib/sticker/index.ts:155

### `Static` version

- get version(): string

  #### Returns string

  - Defined in lib/sticker/index.ts:77

## Methods

### dispose

- dispose(): void

  资源回收

  #### Returns void

  - Defined in lib/sticker/index.ts:201

### locationWithIntersection

- locationWithIntersection(intersection: IntersectionLike, offset?: number): void

  通过焦点快捷设置贴纸位置

  #### Parameters

  - intersection: IntersectionLike

    焦点

  - offset: number = 0.005

    位置值（已通过焦点面的法线位移一定值，防止重叠）

  #### Returns void

  - Defined in lib/sticker/index.ts:188

### setSize

- setSize(width: number, height: number): void

  设置贴纸大小

  #### Parameters

  - width: number

    贴纸长

  - height: number

    贴纸宽

  #### Returns void

  - Defined in lib/sticker/index.ts:169

### setTransparent

- setTransparent(transparent: boolean): void

  设置贴纸背景是否透明

  #### Parameters

  - transparent: boolean

    是否透明

  #### Returns void

  - Defined in lib/sticker/index.ts:178