🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

@ridp/threejs

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ridp/threejs

- useThreeJs 声明:

1.1.7
latest
npm
Version published
Weekly downloads
77
-80.6%
Maintainers
1
Weekly downloads
 
Created
Source

@ridp/threejs

Hooks

  • useThreeJs 声明:

    /**
    * 
    * @param {String} selector  ID  '#xxxx'
    * @param {Object} option - 初始化参数
    * @property {Boolean} option.css3d - 模型
    * @returns any
    */
    function useThreeJs(selector, option)
    

    使用:

    import { useThreeJs } from '@ridp/threejs'
    
    const { scene, camera, renderer, control, domWidth, domHeight, isReady, addAnimate, frameArea } = useThreeJs("#InsId", )
    
    

    返回变量:

    • scene
       THREE.Scene     
      
      
    • camera:
       THREE.PerspectiveCamera 
      
    • renderer
       const renderer = new WebGLRenderer({
          antialias: true,
          alpha: true,
          precision: "mediump",
          logarithmicDepthBuffer: true,
      })
      
    • control
      THREE.OrbitControls
      
    • domWidth
          ref(Number)
      
    • domHeight
          ref(Number)
      
    • isReady
          ref(Boolean)
      

    返回方法:

    • addAnimate

      /**
          * 循环帧中添加执行函数
          * @param {*} animate 
      */
      function addAnimate(animate): void
      
      
    • frameArea

      /**物体视窗自动适应
          *
          * @param {Object3D} model
          * @param {Number} scale
          * @param {Camera} camera
          * @param {OrbitControls} controls
          * @param {Vector3} offset
      */
      function frameArea(model, scale, camera, controls, offset): void
      
  • useRaycaster

  • useObb

  • useGLTFLoader

Instance 实例

Utils 工具

FAQs

Package last updated on 28 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts