Giter Site home page Giter Site logo

musicapp's People

Contributors

ianwith avatar

Watchers

 avatar

musicapp's Issues

Retina屏幕3d切换回来后2d图像缩小一半

初步分析如下:
前提:canvas的width/height为画布能渲染像素的宽高,而style.width/height才是canvas元素本身的宽高。

  1. 第一次进入e0是,由于重置了canvas.width = window.innerWidth,没有设置style,此时Retina屏下浏览器自动缩放,使得canvas充满浏览器窗口,但是显然这是模糊的。
  2. 进入3d效果后,由于使用了renderer.setSize(window.innerWidth, window.innerHeight),这时候实际上就是设置了canvas的style.width/height,而canvas的width/height变成了2倍(估计是threejs识别devicePixelRatio自动设置的)。
  3. 再然后,每次键盘按下的时候,都会重置一次renderer.setSize,同上面一段代码。
  4. 因此,3d回到2d以后,width/height都扩大了,而柱状的宽度barW等等变量是写死的像素,所以整体看上去变小了,变清晰了。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.