zyy-engine

图形引擎API


飞线特效

<h1>飞线特效</h1> <h2>类说明</h2> <ul> <li> <p><strong>BCore.Extension.Effect.FlyLineEffectConfig</strong> 飞线特效配置参数</p> </li> <li> <p><strong>BCore.Extension.Effect.FlyLineEffect</strong><br /> 飞线特效对象</p> </li> <li> <p><strong>BCore.Extension.Effect.FlyLineEffectManagerConfig</strong><br /> 飞线特效管理工具配置</p> </li> <li><strong>BCore.Extension.Effect.FlyLineEffectManager</strong><br /> 飞线特效管理工具</li> </ul> <hr /> <h2>类详解</h2> <h3>1.BCore.Extension.Effect.FlyLineEffectConfig</h3> <p><strong>构造</strong>: <code>new BCore.Extension.Effect.FlyLineEffectConfig()</code></p> <p><strong>成员</strong>:</p> <table> <thead> <tr> <th>成员变量</th> <th>类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td>name</td> <td>String</td> <td>特效名称,全局唯一</td> </tr> <tr> <td>color</td> <td>String</td> <td>飞线颜色</td> </tr> <tr> <td>speed</td> <td>number</td> <td>飞线移动速度</td> </tr> <tr> <td>opacity</td> <td>number</td> <td>透明度</td> </tr> <tr> <td>lineWidth</td> <td>number</td> <td>飞线宽度</td> </tr> <tr> <td>dashArray</td> <td>number</td> <td>飞线留白长度和间距</td> </tr> <tr> <td>dashRatio</td> <td>number</td> <td>飞线留白比例 (0:更可见, 1:更不可见)</td> </tr> <tr> <td>useMap</td> <td>bool</td> <td>是否使用贴图</td> </tr> <tr> <td>map</td> <td>String</td> <td>贴图地址</td> </tr> <tr> <td>repeat</td> <td>{ x: 1.0, y: 1.0 }</td> <td>贴图重复次数</td> </tr> <tr> <td>position</td> <td>[{ x: 0, y: 0, z: 0 }, ...]</td> <td>飞线路径坐标</td> </tr> <tr> <td>rotation</td> <td>{ x: 0, y: 0, z: 0 }</td> <td>特效旋转程度</td> </tr> <tr> <td>sizeAttenuation</td> <td>number</td> <td>线宽是否衰减 (0 - 衰减, 1 - 不衰减)</td> </tr> <tr> <td>depthTest</td> <td>bool</td> <td>是否启用深度测试</td> </tr> </tbody> </table> <hr /> <h3>2.BCore.Extension.Effect.FlyLineEffect</h3> <p><strong>构造</strong>: <code>new BCore.Extension.Effect.FlyLineEffect(config)</code></p> <p><strong>参数</strong>:</p> <table> <thead> <tr> <th>参数名</th> <th>类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td>config</td> <td>BCore.Extension.Effect.FlyLineEffectConfig</td> <td>飞线特效配置参数</td> </tr> </tbody> </table> <hr /> <h3>2.1 示例</h3> <h4>创建飞线特效配置并生成效果</h4> <pre><code class="language-javascript">let flyLineEffectConfig = new BCore.Extension.Effect.FlyLineEffectConfig(); let curve = new THREE.CubicBezierCurve3( new THREE.Vector3(0, 0, 0), new THREE.Vector3(5, 0, 7), new THREE.Vector3(15, 0, 7), new THREE.Vector3(20, 0, 0) ); let points = curve.getPoints(50); let position = []; points.forEach((val) =&amp;gt; { position.push({ x: val.x, y: val.y, z: val.z }); }); flyLineEffectConfig.position = position; flyLineEffectConfig.color = &amp;quot;#ff0000&amp;quot;; flyLineEffectConfig.opacity = 0.8; flyLineEffectConfig.lineWidth = 2.0; flyLineEffectConfig.dashRatio = 0; flyLineEffectConfig.dashArray = 0; flyLineEffectConfig.useMap = true; flyLineEffectConfig.map = pngURL; // 贴图地址 flyLineEffectConfig.speed = 1.0; flyLineEffectConfig.repeat = { x: 2, y: 2 }; flyLineEffectConfig.rotation = { x: 1, y: 1, z: 1 }; let flyLineEffect = new BCore.Extension.Effect.FlyLineEffect(flyLineEffectConfig);</code></pre> <hr /> <h3>3.BCore.Extension.Effect.FlyLineEffectManagerConfig</h3> <p><strong>构造</strong>: <code>new BCore.Extension.Effect.FlyLineEffectManagerConfig(Viewer3D)</code></p> <p><strong>参数</strong>:</p> <table> <thead> <tr> <th>参数名</th> <th>类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td>viewer3D</td> <td>BCore.Viewer.Viewer3D</td> <td>三维模型视图对象</td> </tr> </tbody> </table> <hr /> <h3>4.BCore.Extension.Effect.FlyLineEffectManager</h3> <p><strong>构造</strong>: <code>new BCore.Extension.Effect.FlyLineEffectManager(config)</code></p> <p><strong>参数</strong>:</p> <table> <thead> <tr> <th>参数名</th> <th>类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td>config</td> <td>BCore.Extension.Effect.FlyLineEffectManagerConfig</td> <td>飞线特效管理工具配置</td> </tr> </tbody> </table> <hr /> <h3>4.1 示例</h3> <h4>添加飞线特效</h4> <p><strong>简要描述</strong>: 添加飞线对象<br /> <strong>接口</strong>: <code>addFlyLineEffect(name, flyLineEffect);</code></p> <p><strong>参数</strong>:</p> <table> <thead> <tr> <th>参数名</th> <th>必选</th> <th>类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td>name</td> <td>是</td> <td>string</td> <td>名称</td> </tr> <tr> <td>flyLineEffect</td> <td>是</td> <td>BCore.Extension.Effect.FlyLineEffect</td> <td>飞线对象</td> </tr> </tbody> </table> <p><strong>示例</strong>:</p> <pre><code class="language-javascript">let flyLineEffectManagerConfig = new BCore.Extension.Effect.FlyLineEffectManagerConfig(mViewer3D); let flyLineEffectManager = new BCore.Extension.Effect.FlyLineEffectManager(flyLineEffectManagerConfig); let flyLineEffectConfig = new BCore.Extension.Effect.FlyLineEffectConfig(); let curve = new THREE.CubicBezierCurve3( new THREE.Vector3(0, 0, 0), new THREE.Vector3(5, 0, 7), new THREE.Vector3(15, 0, 7), new THREE.Vector3(20, 0, 0) ); let points = curve.getPoints(50); let position = []; points.forEach((val) =&amp;gt; { position.push({ x: val.x, y: val.y, z: val.z }); }); flyLineEffectConfig.position = position; let flyLineEffect = new BCore.Extension.Effect.FlyLineEffect(flyLineEffectConfig); flyLineEffectManager.addFlyLineEffect(&amp;quot;flyLine&amp;quot;, flyLineEffect);</code></pre> <hr /> <h4>移除飞线特效</h4> <p><strong>简要描述</strong>: 移除飞线对象<br /> <strong>接口</strong>: <code>removeFlyLineEffect(name);</code></p> <p><strong>参数</strong>:</p> <table> <thead> <tr> <th>参数名</th> <th>必选</th> <th>类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td>name</td> <td>是</td> <td>string</td> <td>名称</td> </tr> </tbody> </table> <p><strong>示例</strong>:</p> <pre><code class="language-javascript">flyLineEffectManager.removeFlyLineEffect(&amp;quot;flyLine&amp;quot;);</code></pre> <hr /> <p>以上是飞线特效的完整文档,包括类说明、构造方法、参数说明和示例代码等内容。请根据需要进行使用和修改。</p>

页面列表

ITEM_HTML