ConditionalNode.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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"><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>
  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">
  37. <strong>condNode</strong>
  38. </td>
  39. <td class="description last">
  40. <p>The node that defines the condition.</p>
  41. </td>
  42. </tr>
  43. <tr>
  44. <td class="name">
  45. <strong>ifNode</strong>
  46. </td>
  47. <td class="description last">
  48. <p>The node that is evaluate when the condition ends up <code>true</code>.</p>
  49. </td>
  50. </tr>
  51. <tr>
  52. <td class="name">
  53. <strong>elseNode</strong>
  54. </td>
  55. <td class="description last">
  56. <p>The node that is evaluate when the condition ends up <code>false</code>.</p>
  57. <p>Default is <code>null</code>.</p>
  58. </td>
  59. </tr>
  60. </tbody>
  61. </table>
  62. </div>
  63. </div>
  64. <h2 class="subsection-title">Properties</h2>
  65. <div class="member">
  66. <h3 class="name" id="condNode" translate="no">.<a href="#condNode">condNode</a><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  67. <div class="description">
  68. <p>The node that defines the condition.</p>
  69. </div>
  70. </div>
  71. <div class="member">
  72. <h3 class="name" id="elseNode" translate="no">.<a href="#elseNode">elseNode</a><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  73. <div class="description">
  74. <p>The node that is evaluate when the condition ends up <code>false</code>.</p>
  75. <p>Default is <code>null</code>.</p>
  76. </div>
  77. </div>
  78. <div class="member">
  79. <h3 class="name" id="ifNode" translate="no">.<a href="#ifNode">ifNode</a><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  80. <div class="description">
  81. <p>The node that is evaluate when the condition ends up <code>true</code>.</p>
  82. </div>
  83. </div>
  84. <h2 class="subsection-title">Methods</h2>
  85. <h3 class="name name-method" id="getNodeType" translate="no">.<a href="#getNodeType">getNodeType</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span> )</span><span class="type-signature"> : string</span> </h3>
  86. <div class="method">
  87. <div class="description">
  88. <p>This method is overwritten since the node type is inferred from the if/else
  89. nodes.</p>
  90. </div>
  91. <table class="params">
  92. <tbody>
  93. <tr>
  94. <td class="name">
  95. <strong>builder</strong>
  96. </td>
  97. <td class="description last">
  98. <p>The current node builder.</p>
  99. </td>
  100. </tr>
  101. </tbody>
  102. </table>
  103. <dl class="details">
  104. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#getNodeType">Node#getNodeType</a></dt>
  105. </dl>
  106. <dl class="details">
  107. <dt class="tag-returns"><strong>Returns:</strong> The node type.</dt>
  108. </dl>
  109. </div>
  110. <h2 class="subsection-title">Source</h2>
  111. <p>
  112. <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>
  113. </p>
  114. </article>
  115. </section>
  116. <script src="../scripts/linenumber.js"></script>
  117. <script src="../scripts/page.js"></script>
  118. </body>
  119. </html>
粤ICP备19079148号