首页 > 其他分享 >cameraCtrl

cameraCtrl

时间:2024-07-03 19:21:16浏览次数:27  
标签:node camera3D camera pos cameraCtrl cc zoomRatio

cameraCtrl

import Tool from "../farework/scripts/Tool";

const { ccclass, property } = cc._decorator;

@ccclass
export default class cameraCtrl extends cc.Component {
    @property(cc.Camera)
    camera3D: cc.Camera = null;

    onl oad(): void {
        // this.camera3D = Tool.Instance.findNode("Camera", this.node)
    }
    followOne(node, pos = cc.v2(0, 0), zoomRatio = 1.45, time = 0.5) {
        this.follow(this.camera3D, node, pos, zoomRatio, time)
    }

    follow(camera, node, pos = cc.v2(0, 0), zoomRatio = 1.45, time = 0.5) {
        if (!cc.isValid(node)) return;
        camera.node.parent = node
        camera.node.setPosition(pos)
        cc.tween(camera)
            .to(time, { zoomRatio: zoomRatio })
            .start()
    }

    moveBack() {
        this.camera3D.node.setPosition(0, 0)
        this.camera3D.zoomRatio = 1
        this.camera3D.node.parent = this.node
    }

}

 

标签:node,camera3D,camera,pos,cameraCtrl,cc,zoomRatio
From: https://www.cnblogs.com/XianCao/p/18282408

相关文章

  • CameraCtrl:文生视频模型中的摄像机控制革命
    在数字内容创作领域,视频生成技术正迅速发展,其中可控性是实现个性化和高质量视频内容的关键。尽管现有技术在文本到视频(T2V)生成方面取得了进展,但现有的T2V模型往往忽略了摄像机姿态的精确控制,这限制了视频内容的深度和用户参与度。为了解决这一问题,本文将介绍一种名为CameraCtrl......