ConditionalNode.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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 <code>select()</code> method is called in a chaining fashion on a condition. The parameter nodes of <code>select()</code>
  19. determine the outcome of the entire statement.</p></div>
  20. <h2>Code Example</h2>
  21. <div translate="no"><pre><code class="language-js">velocity = position.greaterThanEqual( limit ).select( velocity.negate(), velocity );
  22. </code></pre></div>
  23. </header>
  24. <article>
  25. <div class="container-overview">
  26. <h2>Constructor</h2>
  27. <h3 class="name name-method" id="ConditionalNode" translate="no">new <a href="#ConditionalNode">ConditionalNode</a><span class="signature">( condNode : <span class="param-type"><a href="Node.html">Node</a></span>, ifNode : <span class="param-type"><a href="Node.html">Node</a></span>, elseNode : <span class="param-type"><a href="Node.html">Node</a></span> )</span> </h3>
  28. <div class="method">
  29. <div class="description">
  30. <p>Constructs a new conditional node.</p>
  31. </div>
  32. <table class="params">
  33. <tbody>
  34. <tr>
  35. <td class="name">
  36. <strong translate="no">condNode</strong>
  37. </td>
  38. <td class="description last">
  39. <p>The node that defines the condition.</p>
  40. </td>
  41. </tr>
  42. <tr>
  43. <td class="name">
  44. <strong translate="no">ifNode</strong>
  45. </td>
  46. <td class="description last">
  47. <p>The node that is evaluate when the condition ends up <code>true</code>.</p>
  48. </td>
  49. </tr>
  50. <tr>
  51. <td class="name">
  52. <strong translate="no">elseNode</strong>
  53. </td>
  54. <td class="description last">
  55. <p>The node that is evaluate when the condition ends up <code>false</code>.</p>
  56. <p>Default is <code>null</code>.</p>
  57. </td>
  58. </tr>
  59. </tbody>
  60. </table>
  61. </div>
  62. </div>
  63. <h2 class="subsection-title">Properties</h2>
  64. <div class="member">
  65. <h3 class="name" id="condNode" translate="no">.<a href="#condNode">condNode</a><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  66. <div class="description">
  67. <p>The node that defines the condition.</p>
  68. </div>
  69. </div>
  70. <div class="member">
  71. <h3 class="name" id="elseNode" translate="no">.<a href="#elseNode">elseNode</a><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  72. <div class="description">
  73. <p>The node that is evaluate when the condition ends up <code>false</code>.</p>
  74. <p>Default is <code>null</code>.</p>
  75. </div>
  76. </div>
  77. <div class="member">
  78. <h3 class="name" id="ifNode" translate="no">.<a href="#ifNode">ifNode</a><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  79. <div class="description">
  80. <p>The node that is evaluate when the condition ends up <code>true</code>.</p>
  81. </div>
  82. </div>
  83. <h2 class="subsection-title">Methods</h2>
  84. <h3 class="name name-method" id="generateNodeType" translate="no">.<a href="#generateNodeType">generateNodeType</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span> )</span><span class="type-signature"> : string</span> </h3>
  85. <div class="method">
  86. <div class="description">
  87. <p>This method is overwritten since the node type is inferred from the if/else
  88. nodes.</p>
  89. </div>
  90. <table class="params">
  91. <tbody>
  92. <tr>
  93. <td class="name">
  94. <strong translate="no">builder</strong>
  95. </td>
  96. <td class="description last">
  97. <p>The current node builder.</p>
  98. </td>
  99. </tr>
  100. </tbody>
  101. </table>
  102. <dl class="details">
  103. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#generateNodeType">Node#generateNodeType</a></dt>
  104. </dl>
  105. <dl class="details">
  106. <dt class="tag-returns"><strong>Returns:</strong> The node type.</dt>
  107. </dl>
  108. </div>
  109. <h2 class="subsection-title">Source</h2>
  110. <p>
  111. <a href="https://github.com/mrdoob/three.js/blob/master/src/nodes/math/ConditionalNode.js" translate="no" target="_blank" rel="noopener">src/nodes/math/ConditionalNode.js</a>
  112. </p>
  113. </article>
  114. </section>
  115. <script src="../scripts/linenumber.js"></script>
  116. <script src="../scripts/page.js"></script>
  117. </body>
  118. </html>
粤ICP备19079148号