You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.3 KiB
HTML

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<base href="../../../" />
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
[page:Object3D] &rarr;
<h1>精灵([name]</h1>
<p class="desc">
精灵是一个总是面朝着摄像机的平面,通常含有使用一个半透明的纹理。<br /><br />
精灵不会投射任何阴影,即使设置了<code>castShadow = true</code>也将不会有任何效果。
</p>
<h2>代码示例</h2>
<code>
const map = new THREE.TextureLoader().load( "sprite.png" );
const material = new THREE.SpriteMaterial( { map: map } );
const sprite = new THREE.Sprite( material );
scene.add( sprite );
</code>
<h2>构造器</h2>
<h3>[name]( [param:Material material] )</h3>
<p>
[page:Material material] - (可选值)是[page:SpriteMaterial]的一个实例。 默认值是一个白色的[page:SpriteMaterial]。<br /><br />
创建一个新的[name]。
</p>
<h2>属性</h2>
<p>共有属性请参见其基类[page:Object3D]。</p>
<h3>[property:Boolean isSprite]</h3>
<p>
只读属性,用于检查给定对象是否为[name]类型。
</p>
<h3>[property:SpriteMaterial material]</h3>
<p>
[page:SpriteMaterial]的一个实例,定义了这个对象的外观。默认值是一个白色的[page:SpriteMaterial]。
</p>
<h3>[property:Vector2 center]</h3>
<p>
这个精灵的锚点,也就是精灵旋转时,围绕着旋转的点。当值为(0.5,0.5)时,对应着这个精灵的中心点;当值为(0,0)时,对应着这个精灵左下角的点。<br>
其默认值是(0.5,0.5)。
</p>
<h2>方法</h2>
<p>共有方法请参见其基类[page:Object3D]。</p>
<h3>[method:this copy]( [param:Sprite sprite] )</h3>
<p>
将前一个Sprite对象的属性复制给当前的这个对象。
</p>
<h3>[method:undefined raycast]( [param:Raycaster raycaster], [param:Array intersects] )</h3>
<p>
在投射的光线和精灵之前产生交互。[page:Raycaster.intersectObject]将会调用这个方法。
在对sprite进行射线投射之前射线投射必须通过调用[page:Raycaster.setFromCamera]()来初始化。 </p>
<h2>源代码</h2>
<p>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</p>
</body>
</html>