cocos-awesome/assets/Scene/Circle_avatar/Circle_avatar.ts

12 lines
304 B
TypeScript
Raw Permalink Normal View History

2020-04-27 16:39:21 +00:00
const { ccclass, property } = cc._decorator;
@ccclass
export default class CircleAvatar extends cc.Component {
@property(cc.Sprite)
rectAvatar: cc.Sprite = null;
start() {
this.rectAvatar.getMaterial(0).setProperty('wh_ratio', this.rectAvatar.node.width / this.rectAvatar.node.height);
}
}