| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>SpotLight - Three.js Docs</title>
- <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
- <script src="../scripts/highlight.min.js"></script>
- <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
- <link type="text/css" rel="stylesheet" href="../styles/page.css">
- </head>
- <body>
- <p class="inheritance" translate="no"><a href="EventDispatcher.html">EventDispatcher</a> → <a href="Object3D.html">Object3D</a> → <a href="Light.html">Light</a> → </p>
- <h1 translate="no">SpotLight</h1>
- <section>
- <header>
- <div class="class-description"><p>This light gets emitted from a single point in one direction, along a cone
- that increases in size the further from the light it gets.</p>
- <p>This light can cast shadows - see the <a href="SpotLightShadow.html">SpotLightShadow</a> for details.</p></div>
- <h2>Code Example</h2>
- <div translate="no"><pre><code class="language-js">// white spotlight shining from the side, modulated by a texture
- const spotLight = new THREE.SpotLight( 0xffffff );
- spotLight.position.set( 100, 1000, 100 );
- spotLight.map = new THREE.TextureLoader().load( url );
- spotLight.castShadow = true;
- spotLight.shadow.mapSize.width = 1024;
- spotLight.shadow.mapSize.height = 1024;
- spotLight.shadow.camera.near = 500;
- spotLight.shadow.camera.far = 4000;
- spotLight.shadow.camera.fov = 30;s
- </code></pre></div>
- </header>
- <article>
- <div class="container-overview">
- <h2>Constructor</h2>
- <h3 class="name name-method" id="SpotLight" translate="no">new <a href="#SpotLight">SpotLight</a><span class="signature">( color : <span class="param-type">number | <a href="Color.html">Color</a> | string</span>, intensity : <span class="param-type">number</span>, distance : <span class="param-type">number</span>, angle : <span class="param-type">number</span>, penumbra : <span class="param-type">number</span>, decay : <span class="param-type">number</span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Constructs a new spot light.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>color</strong>
- </td>
- <td class="description last">
- <p>The light's color.</p>
- <p>Default is <code>0xffffff</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>intensity</strong>
- </td>
- <td class="description last">
- <p>The light's strength/intensity measured in candela (cd).</p>
- <p>Default is <code>1</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>distance</strong>
- </td>
- <td class="description last">
- <p>Maximum range of the light. <code>0</code> means no limit.</p>
- <p>Default is <code>0</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>angle</strong>
- </td>
- <td class="description last">
- <p>Maximum angle of light dispersion from its direction whose upper bound is <code>Math.PI/2</code>.</p>
- <p>Default is <code>Math.PI/3</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>penumbra</strong>
- </td>
- <td class="description last">
- <p>Percent of the spotlight cone that is attenuated due to penumbra. Value range is <code>[0,1]</code>.</p>
- <p>Default is <code>0</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>decay</strong>
- </td>
- <td class="description last">
- <p>The amount the light dims along the distance of the light.</p>
- <p>Default is <code>2</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <h2 class="subsection-title">Properties</h2>
- <div class="member">
- <h3 class="name" id="angle" translate="no">.<a href="#angle">angle</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>Maximum angle of light dispersion from its direction whose upper bound is <code>Math.PI/2</code>.</p>
- <p>Default is <code>Math.PI/3</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="decay" translate="no">.<a href="#decay">decay</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>The amount the light dims along the distance of the light. In context of
- physically-correct rendering the default value should not be changed.</p>
- <p>Default is <code>2</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="distance" translate="no">.<a href="#distance">distance</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>Maximum range of the light. <code>0</code> means no limit.</p>
- <p>Default is <code>0</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="isSpotLight" translate="no">.<a href="#isSpotLight">isSpotLight</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
- <div class="description">
- <p>This flag can be used for type testing.</p>
- <p>Default is <code>true</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="map" translate="no">.<a href="#map">map</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
- <div class="description">
- <p>A texture used to modulate the color of the light. The spot light
- color is mixed with the RGB value of this texture, with a ratio
- corresponding to its alpha value. The cookie-like masking effect is
- reproduced using pixel values (0, 0, 0, 1-cookie_value).</p>
- <p><em>Warning</em>: This property is disabled if <a href="Object3D.html#castShadow">Object3D#castShadow</a> is set to <code>false</code>.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="penumbra" translate="no">.<a href="#penumbra">penumbra</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>Percent of the spotlight cone that is attenuated due to penumbra.
- Value range is <code>[0,1]</code>.</p>
- <p>Default is <code>0</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="power" translate="no">.<a href="#power">power</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>The light's power. Power is the luminous power of the light measured in lumens (lm).
- Changing the power will also change the light's intensity.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="shadow" translate="no">.<a href="#shadow">shadow</a><span class="type-signature"> : <a href="SpotLightShadow.html">SpotLightShadow</a></span> </h3>
- <div class="description">
- <p>This property holds the light's shadow configuration.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="target" translate="no">.<a href="#target">target</a><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
- <div class="description">
- <p>The spot light points from its position to the
- target's position.</p>
- <p>For the target's position to be changed to anything other
- than the default, it must be added to the scene.</p>
- <p>It is also possible to set the target to be another 3D object
- in the scene. The light will now track the target object.</p>
- </div>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <a href="https://github.com/mrdoob/three.js/blob/master/src/lights/SpotLight.js" translate="no" target="_blank" rel="noopener">src/lights/SpotLight.js</a>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|