new GifMaterialProperty(viewer, options)
Parameters:
Name | Type | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
viewer |
viewer | ||||||||||||||||||||||||||
options |
Object | 包含下列值 Properties
|
Example
// 1. use primitive: let viewer = Freedo.FdApp.createDefaultViewer('freedoContainer'); let src = './example.gif'; let gmp = new Freedo.FdEffect.GifMaterialProperty(viewer, { src }); gmp.promise.then(() => { let material = gmp.getMaterial(); let primitive = new Freedo.Primitive({ geometryInstances: new Freedo.GeometryInstance({ geometry: new Freedo.RectangleGeometry({ rectangle: Freedo.Rectangle.fromDegrees(100, 30, 120, 40), vertexFormat: Freedo.MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat, height: 100000 }) }), appearance: new Freedo.MaterialAppearance({ material: material }), }); viewer.scene.primitives.add(primitive); }).catch(err => { throw err; }); // 2. use entity: let gmp2 = new Freedo.FdEffect.GifMaterialProperty(viewer, { src }); gmp2.promise.then(() => { let entity = viewer.entities.add({ position: Freedo.Cartesian3.fromDegrees(103.9526, 30.7617, 300000), ellipsoid: { radii: new Freedo.Cartesian3(240000, 240000, 240000), material: gmp2 } }) }).catch(err => { throw err });
Methods
-
destroy()
-
销毁
-
equals( [other])
-
Compares this property to the provided property and returns
true
if they are equal,false
otherwise.Parameters:
Name Type Argument Description other
Property <optional>
The other property.
Returns:
true
if left and right are equal,false
otherwise.- Type
- Boolean
-
getData()
-
获取数据
Returns:
返回值格式:
{ frames:[image, image, image, ...], // 图片帧数组 times: [400, 400, ...], // 对应帧之间的间隔时间 width: 300, // 图片宽度 counts: 20 // 图片帧的数量 }
- Type
- Object
-
getMaterial()
-
使用 primitive 方式时,获取 material,指定给 MaterialAppearance
Returns:
gif 帧生成的动态材质
- Type
- Material
-
getTexture()
-
获取动态 texture
Returns:
gif 帧生成的动态纹理
- Type
- Texture
-
getType(time)
-
Gets the Material type at the provided time.
Parameters:
Name Type Description time
JulianDate The time for which to retrieve the type.
Returns:
The type of material.
- Type
- String
-
getValue(time [, result])
-
Gets the value of the property at the provided time.
Parameters:
Name Type Argument Description time
JulianDate The time for which to retrieve the value.
result
Object <optional>
The object to store the value into, if omitted, a new instance is created and returned.
Returns:
The modified result parameter or a new instance if the result parameter was not supplied.
- Type
- Object
-
nextFrame()
-
当 gif 动画暂停时,可显示下一帧图片
-
pause()
-
暂停播放动画
-
play()
-
继续播放动画
-
toggle()
-
切换播放/暂停