하나의 주 캔버스, 즉 스테이지가있는 PIXI JS를 사용하여 인터페이스를 만들려고합니다. 그 후 나는 무대의 어린 아이로서 그래픽 요소를 가지고있다. 그래픽 요소를 클릭하면 요소를 확대하여 내 캔버스의 80 %를 채울 수 있기를 원합니다. 내 주요 목표는 여러 요소를 가지고 있으며 각 요소를 클릭하면 캔버스가 확대되고 그 요소 만 표시됩니다.하위 요소 확대 PixiJS
지금까지했던 어떤 :
this.renderer = this.PIXI.autoDetectRenderer(window.innerWidth, window.innerHeight, {
transparent: true,
anitalias: true
});
this.stage = new this.PIXI.Container();
this.graphics = new this.PIXI.Graphics();
this.graphics.beginFill(0x2F7455);
this.graphics.drawRect(100, 100, 75, 50);
this.graphics.endFill();
this.graphics.interactive = true;
this.graphics.click = function(){
self.animate = true;
self.grow();
console.log("I WAS CLICKED");
}
this.stage.addChild(this.graphics);
animation() {
requestAnimationFrame(this.animation.bind(this));
this.renderer.render(this.stage);
}
grow() {
this.stage.pivot.x = this.graphics.width/2;
this.stage.pivot.y = this.graphics.height/2;
if (this.stage.scale.x < 20) {
this.stage.scale.x = (this.stage.scale.x * 1.25).toFixed(1);
}
if (this.stage.scale.y < 20) {
this.stage.scale.y = (this.stage.scale.y * 1.25).toFixed(1);
}
}
그래서 캔버스에 확대 그래픽 요소를 클릭에하지만 내가 원하는 게 아니에요 내가 그 것이다 논리 주위에 내 머리를 정리하고 수없는 것. 내가 원하는 것을 얻을 수 있도록 도와주세요.
누구나 취해야 할 접근법에 대한 아이디어가 있습니까?
그래픽은 단지 사각형입니다. 확대 한 후에는 렌더러의 크기가되기를 원합니다. –