KineticJS Canvas - 从中心点缩放组
本文介绍了KineticJS Canvas - 从中心点缩放组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想扩展我的组(图像和其他内容).
I want to scale my group (image and something).
http://jsfiddle.net/K8nK3/
But when i scale my group, I think it's not scale from center of my group. i think it like this
I want it scale from center like
I try more but it's not success. How can i do that, thanks.
解决方案
[Edited to better fit questioner's needs]
Here’s how to scale a Kinetic group from the centerpoint
First we store the centerX and centerY of the original group so we can keep the group centered there:
Then we write a custom scaling method that both scales the group and re-centers it:
Here’s code and a Fiddle: http://jsfiddle.net/m1erickson/dVGGz/
这篇关于KineticJS Canvas - 从中心点缩放组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!