mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
10 lines
595 B
JavaScript
10 lines
595 B
JavaScript
----------------------------------------------------
|
|
// 1. Create a cc.SpriteFrame with image path
|
|
var frame1 = new cc.SpriteFrame("res/grossini_dance.png",cc.rect(0,0,90,128));
|
|
var frame2 = new cc.SpriteFrame("res/grossini_dance.png",cc.rect(0,0,90,128),false,0,cc.size(90,128));
|
|
|
|
// 2. Create a cc.SpriteFrame with a texture, rect, rotated, offset and originalSize in pixels.
|
|
var texture = cc.textureCache.addImage("res/grossini_dance.png");
|
|
var frame1 = new cc.SpriteFrame(texture, cc.rect(0,0,90,128));
|
|
var frame2 = new cc.SpriteFrame(texture, cc.rect(0,0,90,128),false,0,cc.size(90,128));
|