console
const app = new PIXI.Application({
width:800,
height:500,
view:document.getElementById('my-canvas')
})
const p1 =new PIXI.Sprite.from('https://editor-engine.test.bhbapp.cn/images/1.jpg')
p1.width = 300
p1.height = 200
const c1 =new PIXI.Container()
c1.x = 300
const m1 = new PIXI.Graphics()
m1.beginFill(0xff0000)
m1.drawRect(0,0,300,200)
m1.endFill()
p1.x = 0
m1.x = 0
app.stage.addChild(c1)
c1.addChild(p1)
c1.addChild(m1)
p1.scale.x *= -1
p1.x += m1.width
p1.mask = m1
c1.pivot.set(m1.width / 2,m1.height / 2)
c1.x += m1.width / 2
c1.y += m1.height / 2
const btn = document.getElementById('btn-rotate')
btn.addEventListener('click',()=>{
p1.x -= 2
})
<head>
</head>
<body>
<button id="btn-rotate">旋转</button>
<canvas id="my-canvas"></canvas>
</body>