ConditionalNode.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>ConditionalNode - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <p class="inheritance" translate="no"><a href="EventDispatcher.html">EventDispatcher</a> → <a href="Node.html">Node</a> → </p>
  13. <h1 translate="no">ConditionalNode</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>Represents a logical <code>if/else</code> statement. Can be used as an alternative
  17. to the <code>If()</code>/<code>Else()</code> syntax.</p>
  18. <p>The corresponding TSL <code>select()</code> looks like so:</p>
  19. <p>The <code>select()</code> method is called in a chaining fashion on a condition. The parameter nodes of <code>select()</code>
  20. determine the outcome of the entire statement.</p></div>
  21. <h2>Code Example</h2>
  22. <div translate="no"><pre><code class="language-js">velocity = position.greaterThanEqual( limit ).select( velocity.negate(), velocity );
  23. </code></pre></div>
  24. </header>
  25. <article>
  26. <div class="container-overview">
  27. <h2>Constructor</h2>
  28. <h3 class="name name-method" id="ConditionalNode" translate="no">new <a href="#ConditionalNode">ConditionalNode</a><span class="signature">( condNode : <span class="param-type">Node</span>, ifNode : <span class="param-type">Node</span>, elseNode : <span class="param-type">Node</span> )</span> </h3>
  29. <div class="method">
  30. <div class="description">
  31. <p>Constructs a new conditional node.</p>
  32. </div>
  33. <table class="params">
  34. <tbody>
  35. <tr>
  36. <td class="name"><code>condNode</code></td>
  37. <td class="description last"><p>The node that defines the condition.</p></td>
  38. </tr>
  39. <tr>
  40. <td class="name"><code>ifNode</code></td>
  41. <td class="description last"><p>The node that is evaluate when the condition ends up <code>true</code>.</p></td>
  42. </tr>
  43. <tr>
  44. <td class="name"><code>elseNode</code></td>
  45. <td class="description last"><p>The node that is evaluate when the condition ends up <code>false</code>.<br/>Default is <code>null</code>.</p></td>
  46. </tr>
  47. </tbody>
  48. </table>
  49. </div>
  50. </div>
  51. <h2 class="subsection-title">Properties</h2>
  52. <div class="member">
  53. <h3 class="name" id="condNode" translate="no">.<a href="#condNode">condNode</a><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  54. <div class="description">
  55. <p>The node that defines the condition.</p>
  56. </div>
  57. </div>
  58. <div class="member">
  59. <h3 class="name" id="elseNode" translate="no">.<a href="#elseNode">elseNode</a><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  60. <div class="description">
  61. <p>The node that is evaluate when the condition ends up <code>false</code>.<br/>Default is <code>null</code>.</p>
  62. </div>
  63. </div>
  64. <div class="member">
  65. <h3 class="name" id="ifNode" translate="no">.<a href="#ifNode">ifNode</a><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  66. <div class="description">
  67. <p>The node that is evaluate when the condition ends up <code>true</code>.</p>
  68. </div>
  69. </div>
  70. <h2 class="subsection-title">Methods</h2>
  71. <h3 class="name name-method" id="getNodeType" translate="no">.<a href="#getNodeType">getNodeType</a><span class="signature">( builder : <span class="param-type">NodeBuilder</span> )</span><span class="type-signature"> : string</span> </h3>
  72. <div class="method">
  73. <div class="description">
  74. <p>This method is overwritten since the node type is inferred from the if/else
  75. nodes.</p>
  76. </div>
  77. <table class="params">
  78. <tbody>
  79. <tr>
  80. <td class="name"><code>builder</code></td>
  81. <td class="description last"><p>The current node builder.</p></td>
  82. </tr>
  83. </tbody>
  84. </table>
  85. <dl class="details">
  86. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#getNodeType">Node#getNodeType</a></dt>
  87. </dl>
  88. <dl class="details">
  89. <dt class="tag-returns"><strong>Returns:</strong> The node type.</dt>
  90. </dl>
  91. </div>
  92. <h2 class="subsection-title">Source</h2>
  93. <p>
  94. <a href="https://github.com/mrdoob/three.js/blob/master/src/nodes/math/ConditionalNode.js" target="_blank" rel="noopener" translate="no">src/nodes/math/ConditionalNode.js</a>
  95. </p>
  96. </article>
  97. </section>
  98. <script src="../scripts/linenumber.js"></script>
  99. <script src="../scripts/page.js"></script>
  100. </body>
  101. </html>
粤ICP备19079148号