1e41f4b71Sopenharmony_ci# SceneResource
2e41f4b71Sopenharmony_ciThe SceneResource module provides basic resource types in 3D graphics.
3e41f4b71Sopenharmony_ci
4e41f4b71Sopenharmony_ci> **NOTE**
5e41f4b71Sopenharmony_ci>
6e41f4b71Sopenharmony_ci> The initial APIs of this module are supported since API version 12. Newly added APIs will be marked with a superscript to indicate their earliest API version.
7e41f4b71Sopenharmony_ci
8e41f4b71Sopenharmony_ci## Modules to Import
9e41f4b71Sopenharmony_ci```ts
10e41f4b71Sopenharmony_ciimport { SceneResourceType, SceneResource, Shader, MaterialType, Material, ShaderMaterial,
11e41f4b71Sopenharmony_ci  SubMesh, Mesh, Animation, EnvironmentBackgroundType, Environment, Image } from '@kit.ArkGraphics3D';
12e41f4b71Sopenharmony_ci```
13e41f4b71Sopenharmony_ci## SceneResourceType
14e41f4b71Sopenharmony_ciEnumerates the scene resource types, which are used to classify resources in a scene.
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUi.Graphics3D
17e41f4b71Sopenharmony_ci
18e41f4b71Sopenharmony_ci| Name| Value| Description|
19e41f4b71Sopenharmony_ci| ---- | ---- | ---- |
20e41f4b71Sopenharmony_ci| UNKNOWN | 0 | Unknown.|
21e41f4b71Sopenharmony_ci| NODE | 1 | Node resource.|
22e41f4b71Sopenharmony_ci| ENVIRONMENT | 2 | Environment resource.|
23e41f4b71Sopenharmony_ci| MATERIAL | 3 | Material resource.|
24e41f4b71Sopenharmony_ci| MESH | 4 | Mesh resource.|
25e41f4b71Sopenharmony_ci| ANIMATION | 5 | Animation resource.|
26e41f4b71Sopenharmony_ci| SHADER | 6 | Shader resource.|
27e41f4b71Sopenharmony_ci| IMAGE | 7 | Image resource.|
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ci## SceneResource
30e41f4b71Sopenharmony_ciDescribes a resource in a scene.
31e41f4b71Sopenharmony_ci
32e41f4b71Sopenharmony_ci### Properties
33e41f4b71Sopenharmony_ci
34e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUi.Graphics3D
35e41f4b71Sopenharmony_ci
36e41f4b71Sopenharmony_ci| Name| Type| Read Only| Optional| Description|
37e41f4b71Sopenharmony_ci| ---- | ---- | ---- | ---- | ---- |
38e41f4b71Sopenharmony_ci| name | string | No| No| Name. There is no special format requirement.|
39e41f4b71Sopenharmony_ci| resourceType | [SceneResourceType](#sceneresourcetype) | Yes| No| Scene resource type. The default value is undefined.|
40e41f4b71Sopenharmony_ci| uri | [Resource](../apis-arkui/arkui-ts/ts-types.md#resource) | Yes| Yes| Resource to load. The default value is undefined.|
41e41f4b71Sopenharmony_ci
42e41f4b71Sopenharmony_ci### destroy
43e41f4b71Sopenharmony_cidestroy(): void
44e41f4b71Sopenharmony_ci
45e41f4b71Sopenharmony_ciDestroys the scene resource and releases all associated resources or references. Once released, the resource can no longer be used or accessed.
46e41f4b71Sopenharmony_ci
47e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUi.Graphics3D
48e41f4b71Sopenharmony_ci
49e41f4b71Sopenharmony_ci**Example**
50e41f4b71Sopenharmony_ci```ts
51e41f4b71Sopenharmony_ciimport { Image, Shader, MaterialType, Material, ShaderMaterial, Animation, Environment, Container, SceneNodeParameters,
52e41f4b71Sopenharmony_ci  LightType, Light, Camera, SceneResourceParameters, SceneResourceFactory, Scene, Node } from '@kit.ArkGraphics3D';
53e41f4b71Sopenharmony_ci
54e41f4b71Sopenharmony_cifunction destroy() : void {
55e41f4b71Sopenharmony_ci  let scene: Promise<Scene> = Scene.load($rawfile("gltf/CubeWithFloor/glTF/AnimatedCube.gltf"));
56e41f4b71Sopenharmony_ci  scene.then(async (result: Scene) => {
57e41f4b71Sopenharmony_ci    if (result) {
58e41f4b71Sopenharmony_ci      let sceneFactory: SceneResourceFactory = result.getResourceFactory();
59e41f4b71Sopenharmony_ci      let sceneResourceParameter: SceneResourceParameters = { name: "shaderResource",
60e41f4b71Sopenharmony_ci        uri: $rawfile("shaders/custom_shader/custom_material_sample.shader") };
61e41f4b71Sopenharmony_ci      let shader: Promise<Shader> = sceneFactory.createShader(sceneResourceParameter);
62e41f4b71Sopenharmony_ci      shader.then(async (shaderResult:Shader) => {
63e41f4b71Sopenharmony_ci         // Release the resource.
64e41f4b71Sopenharmony_ci         shaderResult.destroy();
65e41f4b71Sopenharmony_ci      });
66e41f4b71Sopenharmony_ci    }
67e41f4b71Sopenharmony_ci  });
68e41f4b71Sopenharmony_ci}
69e41f4b71Sopenharmony_ci```
70e41f4b71Sopenharmony_ci
71e41f4b71Sopenharmony_ci## Shader
72e41f4b71Sopenharmony_ciShader resource, which inherits from [SceneResource](#sceneresource).
73e41f4b71Sopenharmony_ci
74e41f4b71Sopenharmony_ci### Properties
75e41f4b71Sopenharmony_ci
76e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUi.Graphics3D
77e41f4b71Sopenharmony_ci
78e41f4b71Sopenharmony_ci| Name| Type| Read Only| Optional| Description|
79e41f4b71Sopenharmony_ci| ---- | ---- | ---- | ---- | ---- |
80e41f4b71Sopenharmony_ci| inputs | Record<string, number \| Vec2 \| Vec3 \| Vec4 \| Image> | Yes| No| Inputs of the shader.|
81e41f4b71Sopenharmony_ci
82e41f4b71Sopenharmony_ci## MaterialType
83e41f4b71Sopenharmony_ciEnumerates the material types in a scene.
84e41f4b71Sopenharmony_ci
85e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUi.Graphics3D
86e41f4b71Sopenharmony_ci
87e41f4b71Sopenharmony_ci| Name| Value| Description|
88e41f4b71Sopenharmony_ci| ---- | ---- | ---- |
89e41f4b71Sopenharmony_ci| SHADER | 1 | Shader-defined.|
90e41f4b71Sopenharmony_ci
91e41f4b71Sopenharmony_ci## Material
92e41f4b71Sopenharmony_ciMaterial resource, which inherits from [SceneResource](#sceneresource).
93e41f4b71Sopenharmony_ci### Properties
94e41f4b71Sopenharmony_ci
95e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUi.Graphics3D
96e41f4b71Sopenharmony_ci
97e41f4b71Sopenharmony_ci| Name| Type| Read Only| Optional| Description|
98e41f4b71Sopenharmony_ci| ---- | ---- | ---- | ---- | ---- |
99e41f4b71Sopenharmony_ci| materialType | [MaterialType](#materialtype) | Yes| No| Material type.|
100e41f4b71Sopenharmony_ci
101e41f4b71Sopenharmony_ci## ShaderMaterial
102e41f4b71Sopenharmony_ciShader material, which inherits from [Material](#material).
103e41f4b71Sopenharmony_ci### Properties
104e41f4b71Sopenharmony_ci
105e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUi.Graphics3D
106e41f4b71Sopenharmony_ci
107e41f4b71Sopenharmony_ci| Name| Type| Read Only| Optional| Description|
108e41f4b71Sopenharmony_ci| ---- | ---- | ---- | ---- | ---- |
109e41f4b71Sopenharmony_ci| colorShader | [Shader](#shader) | No| Yes| Shader. The default value is undefined.|
110e41f4b71Sopenharmony_ci
111e41f4b71Sopenharmony_ci## SubMesh
112e41f4b71Sopenharmony_ciSub-mesh resource.
113e41f4b71Sopenharmony_ci### Properties
114e41f4b71Sopenharmony_ci
115e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUi.Graphics3D
116e41f4b71Sopenharmony_ci
117e41f4b71Sopenharmony_ci| Name| Type| Read Only| Optional| Description|
118e41f4b71Sopenharmony_ci| ---- | ---- | ---- | ---- | ---- |
119e41f4b71Sopenharmony_ci| name | string | No| No| Name. There is no special format requirement.|
120e41f4b71Sopenharmony_ci| material | [Material](#material) | No| No| Material.|
121e41f4b71Sopenharmony_ci| aabb | [Aabb](js-apis-inner-scene-types.md#aabb) | Yes| No| Axis aligned bounding box.|
122e41f4b71Sopenharmony_ci
123e41f4b71Sopenharmony_ci## Mesh
124e41f4b71Sopenharmony_ciMesh resource, which inherits from [SceneResource](#sceneresource).
125e41f4b71Sopenharmony_ci### Properties
126e41f4b71Sopenharmony_ci
127e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUi.Graphics3D
128e41f4b71Sopenharmony_ci
129e41f4b71Sopenharmony_ci| Name| Type| Read Only| Optional| Description|
130e41f4b71Sopenharmony_ci| ---- | ---- | ---- | ---- | ---- |
131e41f4b71Sopenharmony_ci| subMeshes | [SubMesh](#submesh)[] | Yes| No| Array of sub-meshes.|
132e41f4b71Sopenharmony_ci| aabb | [Aabb](js-apis-inner-scene-types.md#aabb) | Yes| No| Axis aligned bounding box.|
133e41f4b71Sopenharmony_ci| materialOverride | [Material](#material) | No| Yes| Material. The default value is undefined.|
134e41f4b71Sopenharmony_ci
135e41f4b71Sopenharmony_ci## Animation
136e41f4b71Sopenharmony_ciAnimation resource, which inherits from [SceneResource](#sceneresource).
137e41f4b71Sopenharmony_ci### Properties
138e41f4b71Sopenharmony_ci
139e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUi.Graphics3D
140e41f4b71Sopenharmony_ci
141e41f4b71Sopenharmony_ci| Name| Type| Read Only| Optional| Description|
142e41f4b71Sopenharmony_ci| ---- | ---- | ---- | ---- | ---- |
143e41f4b71Sopenharmony_ci| enabled | boolean | No| No| Whether the animation is enabled. The value **true** means that the animation can be played, and **false** means the opposite.|
144e41f4b71Sopenharmony_ci| duration | number | Yes| No| Duration of the animation. The value is greater than or equal to 0.|
145e41f4b71Sopenharmony_ci| running | boolean | Yes| No| Running status of the animation. The value **true** means that the animation is being played, and **false** means the opposite.|
146e41f4b71Sopenharmony_ci| progress | number | Yes| No| Playing progress of the animation. The value range is [0, 1].|
147e41f4b71Sopenharmony_ci
148e41f4b71Sopenharmony_ci### onFinished
149e41f4b71Sopenharmony_cionFinished(callback: Callback\<void>): void
150e41f4b71Sopenharmony_ci
151e41f4b71Sopenharmony_ciCalled when the animation playback is complete or the **finish** API is called.
152e41f4b71Sopenharmony_ci
153e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUi.Graphics3D
154e41f4b71Sopenharmony_ci
155e41f4b71Sopenharmony_ci**Parameters**
156e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description|
157e41f4b71Sopenharmony_ci| ---- | ---- | ---- | ---- |
158e41f4b71Sopenharmony_ci| callback | Callback\<void> | Yes| Callback function. The return value is null.|
159e41f4b71Sopenharmony_ci
160e41f4b71Sopenharmony_ci**Example**
161e41f4b71Sopenharmony_ci```ts
162e41f4b71Sopenharmony_ciimport { Image, Shader, MaterialType, Material, ShaderMaterial, Animation, Environment, Container, SceneNodeParameters,
163e41f4b71Sopenharmony_ci  LightType, Light, Camera, SceneResourceParameters, SceneResourceFactory, Scene, Node } from '@kit.ArkGraphics3D';
164e41f4b71Sopenharmony_ci
165e41f4b71Sopenharmony_cifunction onFinished() : void {
166e41f4b71Sopenharmony_ci  let scene: Promise<Scene> = Scene.load($rawfile("gltf/CubeWithFloor/glTF/AnimatedCube.gltf"));
167e41f4b71Sopenharmony_ci  scene.then(async (result: Scene) => {
168e41f4b71Sopenharmony_ci    if (result) {
169e41f4b71Sopenharmony_ci      let anim: Animation = result.animations[0];
170e41f4b71Sopenharmony_ci      // Register a callback.
171e41f4b71Sopenharmony_ci      anim.onFinished(()=>{
172e41f4b71Sopenharmony_ci        console.info("onFinished");  
173e41f4b71Sopenharmony_ci      });
174e41f4b71Sopenharmony_ci    }
175e41f4b71Sopenharmony_ci  });
176e41f4b71Sopenharmony_ci}
177e41f4b71Sopenharmony_ci```
178e41f4b71Sopenharmony_ci
179e41f4b71Sopenharmony_ci### onStarted
180e41f4b71Sopenharmony_cionStarted(callback: Callback\<void>): void
181e41f4b71Sopenharmony_ci
182e41f4b71Sopenharmony_ciCalled when the animation starts to play. The start operation is triggered by calling **start** or **restart**.
183e41f4b71Sopenharmony_ci
184e41f4b71Sopenharmony_ci**Parameters**
185e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description|
186e41f4b71Sopenharmony_ci| ---- | ---- | ---- | ---- |
187e41f4b71Sopenharmony_ci| callback | Callback\<void> | Yes| Callback function. The return value is null.|
188e41f4b71Sopenharmony_ci
189e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUi.Graphics3D
190e41f4b71Sopenharmony_ci
191e41f4b71Sopenharmony_ci**Example**
192e41f4b71Sopenharmony_ci
193e41f4b71Sopenharmony_ci```ts
194e41f4b71Sopenharmony_ciimport { Image, Shader, MaterialType, Material, ShaderMaterial, Animation, Environment, Container, SceneNodeParameters,
195e41f4b71Sopenharmony_ci  LightType, Light, Camera, SceneResourceParameters, SceneResourceFactory, Scene, Node } from '@kit.ArkGraphics3D';
196e41f4b71Sopenharmony_ci
197e41f4b71Sopenharmony_cifunction onStarted() : void {
198e41f4b71Sopenharmony_ci  let scene: Promise<Scene> = Scene.load($rawfile("gltf/CubeWithFloor/glTF/AnimatedCube.gltf"));
199e41f4b71Sopenharmony_ci  scene.then(async (result: Scene) => {
200e41f4b71Sopenharmony_ci    if (result) {
201e41f4b71Sopenharmony_ci      let anim: Animation = result.animations[0];
202e41f4b71Sopenharmony_ci      // Register a callback.
203e41f4b71Sopenharmony_ci      anim.onStarted(()=>{
204e41f4b71Sopenharmony_ci        console.info("onStarted");  
205e41f4b71Sopenharmony_ci      });
206e41f4b71Sopenharmony_ci    }
207e41f4b71Sopenharmony_ci  });
208e41f4b71Sopenharmony_ci}
209e41f4b71Sopenharmony_ci```
210e41f4b71Sopenharmony_ci
211e41f4b71Sopenharmony_ci### pause
212e41f4b71Sopenharmony_cipause(): void
213e41f4b71Sopenharmony_ci
214e41f4b71Sopenharmony_ciPauses the animation. The animation remains in the current playing progress.
215e41f4b71Sopenharmony_ci
216e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUi.Graphics3D
217e41f4b71Sopenharmony_ci
218e41f4b71Sopenharmony_ci**Example**
219e41f4b71Sopenharmony_ci```ts
220e41f4b71Sopenharmony_ciimport { Image, Shader, MaterialType, Material, ShaderMaterial, Animation, Environment, Container, SceneNodeParameters,
221e41f4b71Sopenharmony_ci  LightType, Light, Camera, SceneResourceParameters, SceneResourceFactory, Scene, Node } from '@kit.ArkGraphics3D';
222e41f4b71Sopenharmony_ci
223e41f4b71Sopenharmony_cifunction pause() : void {
224e41f4b71Sopenharmony_ci  let scene: Promise<Scene> = Scene.load($rawfile("gltf/CubeWithFloor/glTF/AnimatedCube.gltf"));
225e41f4b71Sopenharmony_ci  scene.then(async (result: Scene) => {
226e41f4b71Sopenharmony_ci    if (result) {
227e41f4b71Sopenharmony_ci      let anim: Animation = result.animations[0];
228e41f4b71Sopenharmony_ci      // Pause the animation.
229e41f4b71Sopenharmony_ci      anim.pause();
230e41f4b71Sopenharmony_ci    }
231e41f4b71Sopenharmony_ci  });
232e41f4b71Sopenharmony_ci}
233e41f4b71Sopenharmony_ci```
234e41f4b71Sopenharmony_ci
235e41f4b71Sopenharmony_ci### restart
236e41f4b71Sopenharmony_cirestart(): void
237e41f4b71Sopenharmony_ci
238e41f4b71Sopenharmony_ciPlays the animation from the beginning.
239e41f4b71Sopenharmony_ci
240e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUi.Graphics3D
241e41f4b71Sopenharmony_ci
242e41f4b71Sopenharmony_ci**Example**
243e41f4b71Sopenharmony_ci```ts
244e41f4b71Sopenharmony_ciimport { Image, Shader, MaterialType, Material, ShaderMaterial, Animation, Environment, Container, SceneNodeParameters,
245e41f4b71Sopenharmony_ci  LightType, Light, Camera, SceneResourceParameters, SceneResourceFactory, Scene, Node } from '@kit.ArkGraphics3D';
246e41f4b71Sopenharmony_ci
247e41f4b71Sopenharmony_cifunction restart() : void {
248e41f4b71Sopenharmony_ci  let scene: Promise<Scene> = Scene.load($rawfile("gltf/CubeWithFloor/glTF/AnimatedCube.gltf"));
249e41f4b71Sopenharmony_ci  scene.then(async (result: Scene) => {
250e41f4b71Sopenharmony_ci    if (result) {
251e41f4b71Sopenharmony_ci      let anim: Animation = result.animations[0];
252e41f4b71Sopenharmony_ci      // Restart the animation.
253e41f4b71Sopenharmony_ci      anim.restart();
254e41f4b71Sopenharmony_ci    }
255e41f4b71Sopenharmony_ci  });
256e41f4b71Sopenharmony_ci}
257e41f4b71Sopenharmony_ci```
258e41f4b71Sopenharmony_ci
259e41f4b71Sopenharmony_ci### seek
260e41f4b71Sopenharmony_ciseek(position: number): void
261e41f4b71Sopenharmony_ci
262e41f4b71Sopenharmony_ciPlays the animation from the specified position.
263e41f4b71Sopenharmony_ci
264e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUi.Graphics3D
265e41f4b71Sopenharmony_ci
266e41f4b71Sopenharmony_ci**Parameters**
267e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description|
268e41f4b71Sopenharmony_ci| ---- | ---- | ---- | ---- |
269e41f4b71Sopenharmony_ci| position | number | Yes| Position from which the animation playback starts. The value range is [0, 1].|
270e41f4b71Sopenharmony_ci
271e41f4b71Sopenharmony_ci**Example**
272e41f4b71Sopenharmony_ci```ts
273e41f4b71Sopenharmony_ciimport { Image, Shader, MaterialType, Material, ShaderMaterial, Animation, Environment, Container, SceneNodeParameters,
274e41f4b71Sopenharmony_ci  LightType, Light, Camera, SceneResourceParameters, SceneResourceFactory, Scene, Node } from '@kit.ArkGraphics3D';
275e41f4b71Sopenharmony_ci
276e41f4b71Sopenharmony_cifunction seek() : void {
277e41f4b71Sopenharmony_ci  let scene: Promise<Scene> = Scene.load($rawfile("gltf/CubeWithFloor/glTF/AnimatedCube.gltf"));
278e41f4b71Sopenharmony_ci  scene.then(async (result: Scene) => {
279e41f4b71Sopenharmony_ci    if (result) {
280e41f4b71Sopenharmony_ci      let anim: Animation = result.animations[0];
281e41f4b71Sopenharmony_ci      // Set the animation playback progress to 10%.
282e41f4b71Sopenharmony_ci      anim.seek(0.1);
283e41f4b71Sopenharmony_ci    }
284e41f4b71Sopenharmony_ci  });
285e41f4b71Sopenharmony_ci}
286e41f4b71Sopenharmony_ci```
287e41f4b71Sopenharmony_ci
288e41f4b71Sopenharmony_ci### start
289e41f4b71Sopenharmony_cistart(): void
290e41f4b71Sopenharmony_ci
291e41f4b71Sopenharmony_ciPlays the animation based on the current progress.
292e41f4b71Sopenharmony_ci
293e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUi.Graphics3D
294e41f4b71Sopenharmony_ci
295e41f4b71Sopenharmony_ci**Example**
296e41f4b71Sopenharmony_ci```ts
297e41f4b71Sopenharmony_ciimport { Image, Shader, MaterialType, Material, ShaderMaterial, Animation, Environment, Container, SceneNodeParameters,
298e41f4b71Sopenharmony_ci  LightType, Light, Camera, SceneResourceParameters, SceneResourceFactory, Scene, Node } from '@kit.ArkGraphics3D';
299e41f4b71Sopenharmony_ci
300e41f4b71Sopenharmony_cifunction start() : void {
301e41f4b71Sopenharmony_ci  let scene: Promise<Scene> = Scene.load($rawfile("gltf/CubeWithFloor/glTF/AnimatedCube.gltf"));
302e41f4b71Sopenharmony_ci  scene.then(async (result: Scene) => {
303e41f4b71Sopenharmony_ci    if (result) {
304e41f4b71Sopenharmony_ci      let anim: Animation = result.animations[0];
305e41f4b71Sopenharmony_ci      // Start the animation.
306e41f4b71Sopenharmony_ci      anim.start();
307e41f4b71Sopenharmony_ci    }
308e41f4b71Sopenharmony_ci  });
309e41f4b71Sopenharmony_ci}
310e41f4b71Sopenharmony_ci```
311e41f4b71Sopenharmony_ci
312e41f4b71Sopenharmony_ci### stop
313e41f4b71Sopenharmony_cistop(): void
314e41f4b71Sopenharmony_ci
315e41f4b71Sopenharmony_ciStops playing the animation and sets its progress to **0** (not started).
316e41f4b71Sopenharmony_ci
317e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUi.Graphics3D
318e41f4b71Sopenharmony_ci
319e41f4b71Sopenharmony_ci**Example**
320e41f4b71Sopenharmony_ci```ts
321e41f4b71Sopenharmony_ciimport { Image, Shader, MaterialType, Material, ShaderMaterial, Animation, Environment, Container, SceneNodeParameters,
322e41f4b71Sopenharmony_ci  LightType, Light, Camera, SceneResourceParameters, SceneResourceFactory, Scene, Node } from '@kit.ArkGraphics3D';
323e41f4b71Sopenharmony_ci
324e41f4b71Sopenharmony_cifunction stop() : void {
325e41f4b71Sopenharmony_ci  let scene: Promise<Scene> = Scene.load($rawfile("gltf/CubeWithFloor/glTF/AnimatedCube.gltf"));
326e41f4b71Sopenharmony_ci  scene.then(async (result: Scene) => {
327e41f4b71Sopenharmony_ci    if (result) {
328e41f4b71Sopenharmony_ci      let anim: Animation = result.animations[0];
329e41f4b71Sopenharmony_ci      // Stop playing the animation and set its progress to 0 (not started).
330e41f4b71Sopenharmony_ci      anim.stop();
331e41f4b71Sopenharmony_ci    }
332e41f4b71Sopenharmony_ci  });
333e41f4b71Sopenharmony_ci}
334e41f4b71Sopenharmony_ci```
335e41f4b71Sopenharmony_ci
336e41f4b71Sopenharmony_ci### finish
337e41f4b71Sopenharmony_cifinish(): void
338e41f4b71Sopenharmony_ci
339e41f4b71Sopenharmony_ciFinishes the playing of the animation and sets its progress of **1** (finished).
340e41f4b71Sopenharmony_ci
341e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUi.Graphics3D
342e41f4b71Sopenharmony_ci
343e41f4b71Sopenharmony_ci```ts
344e41f4b71Sopenharmony_ciimport { Image, Shader, MaterialType, Material, ShaderMaterial, Animation, Environment, Container, SceneNodeParameters,
345e41f4b71Sopenharmony_ci  LightType, Light, Camera, SceneResourceParameters, SceneResourceFactory, Scene, Node } from '@kit.ArkGraphics3D';
346e41f4b71Sopenharmony_ci
347e41f4b71Sopenharmony_cifunction finish() : void {
348e41f4b71Sopenharmony_ci  let scene: Promise<Scene> = Scene.load($rawfile("gltf/CubeWithFloor/glTF/AnimatedCube.gltf"));
349e41f4b71Sopenharmony_ci  scene.then(async (result: Scene) => {
350e41f4b71Sopenharmony_ci    if (result) {
351e41f4b71Sopenharmony_ci      let anim: Animation = result.animations[0];
352e41f4b71Sopenharmony_ci      // Finish the playing of the animation and set its progress of **1** (finished).
353e41f4b71Sopenharmony_ci      anim.finish();
354e41f4b71Sopenharmony_ci    }
355e41f4b71Sopenharmony_ci  });
356e41f4b71Sopenharmony_ci}
357e41f4b71Sopenharmony_ci```
358e41f4b71Sopenharmony_ci
359e41f4b71Sopenharmony_ci## EnvironmentBackgroundType
360e41f4b71Sopenharmony_ciEnumerates the environment background types.
361e41f4b71Sopenharmony_ci
362e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUi.Graphics3D
363e41f4b71Sopenharmony_ci
364e41f4b71Sopenharmony_ci| Name| Value| Description|
365e41f4b71Sopenharmony_ci| ---- | ---- | ---- |
366e41f4b71Sopenharmony_ci| BACKGROUND_NONE | 0 | No background.|
367e41f4b71Sopenharmony_ci| BACKGROUND_IMAGE | 1 | Image background.|
368e41f4b71Sopenharmony_ci| BACKGROUND_CUBEMAP | 2 | Cubemap background.|
369e41f4b71Sopenharmony_ci| BACKGROUND_EQUIRECTANGULAR | 3 | Equirectangular background.|
370e41f4b71Sopenharmony_ci
371e41f4b71Sopenharmony_ci## Environment
372e41f4b71Sopenharmony_ciEnvironment resource, which inherits from [SceneResource](#sceneresource).
373e41f4b71Sopenharmony_ci### Properties
374e41f4b71Sopenharmony_ci
375e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUi.Graphics3D
376e41f4b71Sopenharmony_ci
377e41f4b71Sopenharmony_ci| Name| Type| Read Only| Optional| Description|
378e41f4b71Sopenharmony_ci| ---- | ---- | ---- | ---- | ---- |
379e41f4b71Sopenharmony_ci| backgroundType | [EnvironmentBackgroundType](#environmentbackgroundtype) | No| No| Environment background type.|
380e41f4b71Sopenharmony_ci| indirectDiffuseFactor | [Vec4](js-apis-inner-scene-types.md#vec4) | No| No| Indirect diffuse factor.|
381e41f4b71Sopenharmony_ci| indirectSpecularFactor | [Vec4](js-apis-inner-scene-types.md#vec4) | No| No| Indirect specular factor.|
382e41f4b71Sopenharmony_ci| environmentMapFactor | [Vec4](js-apis-inner-scene-types.md#vec4) | No| No| Environment map factor.|
383e41f4b71Sopenharmony_ci| environmentImage | [Image](#image) \| null | No| Yes| Environment image. The default value is undefined.|
384e41f4b71Sopenharmony_ci| radianceImage | [Image](#image) \| null | No| Yes| Radiance image. The default value is undefined.|
385e41f4b71Sopenharmony_ci| irradianceCoefficients | [Vec3](js-apis-inner-scene-types.md#vec3)[] | No| Yes| Irradiance coefficients. The default value is undefined.|
386e41f4b71Sopenharmony_ci
387e41f4b71Sopenharmony_ci## Image
388e41f4b71Sopenharmony_ciImage resource, which inherits from [SceneResource](#sceneresource).
389e41f4b71Sopenharmony_ci### Properties
390e41f4b71Sopenharmony_ci
391e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUi.Graphics3D
392e41f4b71Sopenharmony_ci
393e41f4b71Sopenharmony_ci| Name| Type| Read Only| Optional| Description|
394e41f4b71Sopenharmony_ci| ---- | ---- | ---- | ---- | ---- |
395e41f4b71Sopenharmony_ci| width | number | Yes| No| Image width. The value is greater than 0.|
396e41f4b71Sopenharmony_ci| height | number | Yes| No| Image height. The value is greater than 0.|
397