当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript THREE.Color类代码示例

本文整理汇总了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 ])
        )
      }
    }
  },
开发者ID:arose,项目名称:ngl,代码行数:28,代码来源:ply-parser.ts

示例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()
    }
  }
开发者ID:arose,项目名称:ngl,代码行数:15,代码来源:colormaker.ts

示例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()
  }
}
开发者ID:arose,项目名称:ngl,代码行数:24,代码来源:contact.ts


注:本文中的THREE.Color类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。