本文整理汇总了TypeScript中THREE.Color类的典型用法代码示例。如果您正苦于以下问题:TypeScript Color类的具体用法?TypeScript Color怎么用?TypeScript Color使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Color类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
handleElement: function (geometry: GeometryPLY, elementName: string, element: PLYElement) {
if (elementName === 'vertex') {
geometry.vertices.push(
new Vector3(element.x, element.y, element.z)
)
if ('red' in element && 'green' in element && 'blue' in element) {
geometry.useColor = true
var color = new Color()
color.setRGB(element.red / 255.0, element.green / 255.0, element.blue / 255.0)
geometry.colors.push(color)
}
} else if (elementName === 'face') {
var vertexIndices = element.vertex_indices
if (vertexIndices.length === 3) {
geometry.faces.push(
new Face3(vertexIndices[ 0 ], vertexIndices[ 1 ], vertexIndices[ 2 ])
)
} else if (vertexIndices.length === 4) {
geometry.faces.push(
new Face3(vertexIndices[ 0 ], vertexIndices[ 1 ], vertexIndices[ 3 ]),
new Face3(vertexIndices[ 1 ], vertexIndices[ 2 ], vertexIndices[ 3 ])
)
}
}
},
示例2: constructor
/**
* Create a colormaker instance
* @param {ColormakerParameters} params - colormaker parameter
*/
constructor (params: Partial<ColormakerParameters> = {}) {
this.parameters = createParams(params, ScaleDefaultParameters)
if (typeof this.parameters.value === 'string') {
this.parameters.value = tmpColor.set(this.parameters.value).getHex()
}
if (this.parameters.structure) {
this.atomProxy = this.parameters.structure.getAtomProxy()
}
}
示例3: contactColor
function contactColor (type: ContactType) {
switch (type) {
case ContactType.HydrogenBond:
case ContactType.WaterHydrogenBond:
case ContactType.BackboneHydrogenBond:
return tmpColor.setHex(0x2B83BA).toArray()
case ContactType.Hydrophobic:
return tmpColor.setHex(0x808080).toArray()
case ContactType.HalogenBond:
return tmpColor.setHex(0x40FFBF).toArray()
case ContactType.IonicInteraction:
return tmpColor.setHex(0xF0C814).toArray()
case ContactType.MetalCoordination:
return tmpColor.setHex(0x8C4099).toArray()
case ContactType.CationPi:
return tmpColor.setHex(0xFF8000).toArray()
case ContactType.PiStacking:
return tmpColor.setHex(0x8CB366).toArray()
case ContactType.WeakHydrogenBond:
return tmpColor.setHex(0xC5DDEC).toArray()
default:
return tmpColor.setHex(0xCCCCCC).toArray()
}
}