article thumbnail

Sprite aspect ratio

Cocos

_addEventListeners() this.resize() } protected onDisable() { this._removeEventListeners() _removeEventListeners() } protected _addEventListeners() { director.on(Director.EVENT_AFTER_UPDATE, Director.EVENT_AFTER_UPDATE, this.resize, this) this.node.on(Node.EventType.SIZE_CHANGED, Node.EventType.SIZE_CHANGED, this.resize, this) this.node.on(Node.EventType.ANCHOR_CHANGED,

Sprite 52
article thumbnail

Using Auto Atlas to Create Sprite Sheets

Cocos

[link] Learn how to use the “Auto Atlas” feature to create sprite sheets in this new tutorial! You’ll also learn how to publish sprite sheets from texture packer and import it in your project! This will increase your game’s performance if you have a ton of images to load in your game.

Sprite 52
Insiders

Sign Up for our Newsletter

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Trending Sources

article thumbnail

Awesome Godot Add-ons: Sprite Painter

Game From Scratch

GameFromScratch.com Awesome Godot Add-ons: Sprite Painter Welcome to hopefully what will be a new series, Awesome Godot. This series will shine a focus on some of the most interesting add-ons for the Godot game engine, starting today with Sprite Painter.

Sprite 54
article thumbnail

Sprite keep aspect

Cocos

muxiandong: Best option: you could add a node above the Sprite node’s hierarchy, treat the node where the Sprite component is located as a separate node, and set the sizeMode property to raw.

Sprite 52
article thumbnail

Sprite keep aspect

Cocos

[link] Hi, you can set the sizeMode property of the Sprite to raw, which serves to use the size of the original image. However it will change the size of the node where the current Sprite component is located (UITransform), i.e. if you modify the size of the node then the sizeMode will change to custom.

Sprite 52
article thumbnail

Sprite keep aspect

Cocos

ccclass('PreserveAspectRatioComponent') @requireComponent(Sprite) @executeInEditMode export class PreserveAspectRatioComponent extends Component { private sprite: Sprite private uiTransform: UITransform protected onEnable() { this.sprite = this.getComponent(Sprite) this.uiTransform = this.getComponent(UITransform) this._addEventListeners();

Sprite 52
article thumbnail

How to blur a sprite node

Cocos

I want to blur a sprite node in cocos creator 3.4.7 How do i achieve this? RAAng @huynhthuan @linrm @zzf520 @slackmoehrle @nutrino

Sprite 40