让三个Js 2D游戏响应式
社区您好,
我是三个 JS 的新手。我正在使用三个 JS 创建 2D 游戏,我面临一些使游戏响应的问题,而且当游戏大小减小时,某些功能无法正常工作就像对象上的触摸事件一样。我想知道我们可以将 css 应用到这三个 js 对象,以便我们可以创建响应式设计游戏。
请指导我。
Hello Community,
I am New in Three Js.I am Creating 2D Game With Three JS and I am facing Some issue to make Game Responsive and also when Size of the game play is decrease some functionalities are not working properly like touch event on object.I want to know that can we apply css to the three js objects so that we can create the responsive desing game.
Please Guide me about it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从一开始就将相机和渲染器初始化为窗口大小,然后添加一个事件侦听器,该事件侦听器将更改与屏幕大小相关的对象的属性。通常是这样的:
希望这是您正在寻找的答案。
Initialize your camera and renderer to the window size from the start and then add an event listener that will alter properties of objects that relate to the screen size. Usually something like this:
Hopefully this is the answer you're looking for.