Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mask offset error in case of scaling #1097

Open
rainyt opened this issue Aug 23, 2022 · 1 comment
Open

Mask offset error in case of scaling #1097

rainyt opened this issue Aug 23, 2022 · 1 comment

Comments

@rainyt
Copy link

rainyt commented Aug 23, 2022

image

Hi, Mask offset error in case of scaling.

@rainyt
Copy link
Author

rainyt commented Aug 23, 2022

Code:

import h2d.Graphics;
import h2d.Mask;
import hxd.App;

class Main extends App {
	static function main() {
		new Main();
	}

	override function init() {
		super.init();
		// All right
		var bg = new Graphics(this.s2d);
		bg.beginFill(0x0000ff);
		bg.drawRect(0, 0, 200, 200);
		bg.endFill();
		var mask = new Mask(200, 200, this.s2d);
		var g = new Graphics(mask);
		g.beginFill(0xff0000);
		g.drawRect(0, 0, 200, 200);
		g.endFill();
		mask.scrollX = 100;

		// Bug
		var bg = new Graphics(this.s2d);
		bg.beginFill(0x0000ff);
		bg.drawRect(0, 0, 200, 200);
		bg.endFill();
		var mask = new Mask(200, 200, this.s2d);
		var g = new Graphics(mask);
		g.beginFill(0xff0000);
		g.drawRect(0, 0, 200, 200);
		g.endFill();
		mask.scrollX = 100;
		mask.scaleX = 0.8;
		mask.scaleY = 0.8;
		mask.y = 300;
        bg.scale(mask.scaleX);
        bg.y = mask.y;
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant