LoginSignup
7
6

More than 5 years have passed since last update.

Sprite を指定のサイズに変更する

Last updated at Posted at 2014-04-09

cc.Spriteにそのサイズにするみたいな関数はないので一手間必要だった。

  var sprite = cc.Sprite.create(s_img);
  var size = sprite.getContentSize();
  sprite.setScale(targetSize.width/size.width, targetSize.height/size.height);
  sprite.setContentSize(cc.size(targetSize.width, targetSize.height));
7
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
6