如何在微信小游戏中实现2D页面弹框

如何在微信小游戏中实现2D页面弹框

       const aspect = window.innerHeight / window.innerWidth
        this.scene = options.scene
        this.canvas = document.createElement('canvas')
        this.canvas.width = window.innerWidth
        this.canvas.height = window.innerHeight
        this.texture = new THREE.Texture(this.canvas)
        this.material = new THREE.MeshBasicMaterial({
            map: this.texture,
            transparent: true,
            side:THREE.DoubleSide
        })
        this.geometry = new THREE.PlaneGeometry(window.innerWidth,window.innerHeight)
        this.obj = new THREE.Mesh(this.geometry,this.material)
        this.obj.position.z =1
        this.obj.rotation.y = Math.PI
        this.context = this.canvas.getContext('2d')
        this.context.fillStyle = '#333'
        this.context.fillRect((window.innerWidth-200) / 2,(window.innerHeight-100) / 2, 200, 100)
        this.context.fillStyle = '#eee'
        this.context.font = '20px Georgia'
        this.context.fillText('Game over',(window.innerWidth-200) / 2+50,(window.innerHeight-100) / 2 +50) 
        this.texture.needsUpdate = true
        this.obj.visible = false
        this.scene.add(this.obj)
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容