<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          Matter.js基于 Web 的 2D 圖形引擎

          聯(lián)合創(chuàng)作 · 2023-09-29 17:06

          Matter.js 是一個(gè)基于 Web 的 2D 圖形引擎。

          特性:

          • 物理屬性(質(zhì)量、面積、密度等)

          • 任何凸多邊形的剛體

          • 穩(wěn)定的疊加和 resting

          • 碰撞 (broad-phase, mid-phase and narrow-phase)

          • Restitution (elastic and inelastic collisions)

          • Conservation of momentum

          • Friction and resistance

          • Constraints

          • Gravity

          • Composite bodies

          • Sleeping and static bodies

          • Events

          • Rounded corners (chamfering)

          • Views (translate, zoom)

          • Collision queries (raycasting, region tests)

          • Time scaling (slow-mo, speed-up)

          • Canvas renderer (supports vectors and textures)

          • WebGL renderer (requires pixi.js)

          • MatterTools for creating, testing and debugging worlds

          • World state serialisation (requires resurrect.js)

          • Cross-browser (Chrome, Firefox, Safari, IE8+)

          • Mobile-compatible (touch, responsive)

          • An original JavaScript physics implementation (not a port)

          示例代碼:

          // Matter.js module aliases
          var Engine = Matter.Engine,
              World = Matter.World,
              Bodies = Matter.Bodies;
          
          // create a Matter.js engine
          var engine = Engine.create(document.body);
          
          // create two boxes and a ground
          var boxA = Bodies.rectangle(400, 200, 80, 80);
          var boxB = Bodies.rectangle(450, 50, 80, 80);
          var ground = Bodies.rectangle(400, 610, 810, 60, { isStatic: true });
          
          // add all of the bodies to the world
          World.add(engine.world, [boxA, boxB, ground]);
          
          // run the engine
          Engine.run(engine);

          瀏覽 18
          點(diǎn)贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評論
          圖片
          表情
          推薦
          點(diǎn)贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  久久午夜无码鲁丝片午夜精1 | 欧美激情精品久久久久久变态 | 亚洲无码不卡 | 日本中文字幕播放 | 精品人妻伦一二三区蜜桃 |