图片顶端坐标绘制

 在某图片进行缩放和旋转操作之后,若想找到顶点坐标可如下:

private UpdatabecomebuttonUI() {

		//更新选中图片轮廓
		this.ShapeGroup.removeChildren();
		var shape: egret.Shape = new egret.Shape();
		shape.graphics.lineStyle(2, 0xff00ff);
		this.NowchooseDecoration.y, 10);

		//左上 左下  右上 右下
		let leftup = new egret.Point(0, 0);
		let leftdown = new egret.Point(0, 0);;
		let rightup = new egret.Point(0, 0);;
		let rightdown = new egret.Point(0, 0);;
		let tanB = this.NowchooseDecoration.width / this.NowchooseDecoration.height;
		let B = Math.atan(tanB) / (Math.PI / 180);
		let numangle = this.NowchooseDecoration.rotation + B;
		let numangle2 = this.NowchooseDecoration.rotation - B;
		let xiebian = Math.sqrt(Math.pow(this.NowchooseDecoration.height / 2, 2) + Math.pow(this.NowchooseDecoration.width / 2, 2)) * this.NowchooseDecoration.scaleY;
		let x = 0;
		let y = 0;
		if (numangle > 360) {
			numangle -= 360;
		}
		leftup.x = this.NowchooseDecoration.x + xiebian * Math.cos((90 - numangle2) * Math.PI / 180);
		leftup.y = this.NowchooseDecoration.y - xiebian * Math.sin((90 - numangle2) * Math.PI / 180);
		leftdown.x = this.NowchooseDecoration.x - xiebian * Math.cos((90 - numangle) * Math.PI / 180);
		leftdown.y = this.NowchooseDecoration.y + xiebian * Math.sin((90 - numangle) * Math.PI / 180);
		rightup.x = this.NowchooseDecoration.x + xiebian * Math.cos((90 - numangle) * Math.PI / 180);
		rightup.y = this.NowchooseDecoration.y - xiebian * Math.sin((90 - numangle) * Math.PI / 180);
		rightdown.x = this.NowchooseDecoration.x - xiebian * Math.cos((90 - numangle2) * Math.PI / 180);
		rightdown.y = this.NowchooseDecoration.y + xiebian * Math.sin((90 - numangle2) * Math.PI / 180);
		

		this.NowchooseDecoration.anchorOffsetX + 201, this.NowchooseDecoration.y + this.NowchooseDecoration.anchorOffsetY + 201, 10);

		shape.graphics.moveTo(leftup.x, leftup.y);
		shape.graphics.lineTo(rightup.x, rightup.y);
		shape.graphics.lineTo(rightdown.x, rightdown.y);
		shape.graphics.lineTo(leftdown.x, leftdown.y);
		shape.graphics.lineTo(leftup.x, leftup.y);
		this.ShapeGroup.addChild(shape);

		


	}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值