我正在尝试缩小图像以适合 Canvas 。我知道通常的方法:
var width = img.width-(img.width-canvas.width);
var height = img.height-(img.height-canvas.height);
但我希望使用基于 0(0%)和 1(大小的 100%)的 img.setScale() 来实现。我不知道如何在 KineticJS 中做到这一点。如有任何建议,我们将不胜感激!
最佳答案
@philipp 的回答做到了:
scalefactor = desiredSize / size, for both width and height
关于javascript - Kinetic JS - 缩放图像以适合 Canvas ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13754465/