Skip to content

Three.jsPlatform Adapter

小程序专属的 three.js 适配工具,一键集成,支持 tres.js 、 react-three-fiber 等主流生态。

Three.js Platform Adapter

简单使用

仅需几行代码,即可在小程序/小游戏中原样使用 three.js 搭建三维场景。

js
// index.js 
// for wechat 根据平台引入兼容层
import '@minisheep/mini-program-polyfill-core/wechat-polyfill';
import '@minisheep/three-platform-adapter/wechat';

// scene.js 
import * as THREE from 'three';
import { adapter } from '@minisheep/three-platform-adapter';

adapter.useCanvas('#canvas').then(({ canvas, requestAnimationFrame }) => {
  const renderer = new THREE.WebGLRenderer({ canvas });
  // ...
})