0

我使用 PGraphics 从旋转图像中复制,现在我希望副本以相反的方式旋转。有人可以帮我吗?我对编码真的很陌生。这将是一个很大的初学者错误,我很抱歉。谢谢你的帮助!

代码中的这一部分什么都不做:
pushMatrix();
翻译(鼠标X,鼠标Y);
旋转(弧度(frameCount));
翻译(-mouseX,-mouseY);
复制(pg,sx,sy,sw,sh,dx,dy,dw,dh);
弹出矩阵();

这是完整的代码:

PImage bg;
PImage glas;
PImage schatten;
PImage type;
PGraphics pg;

void setup(){
size (1000,1000,P2D);
bg = loadImage("bg.png");
glas = loadImage("glas.png");
schatten = loadImage("schatten425x425.png");
type = loadImage("qoute1.png");
pg = createGraphics(width,height);
frameRate(30);
imageMode(CENTER);
}
  
void draw (){ 
image(bg,width/2, height/2,width,height);

pg.beginDraw();
pg.pushMatrix();
pg.translate(mouseX, mouseY);
pg.rotate(radians(-frameCount));
pg.translate(-mouseX, -mouseY);
pg.image(glas,0,0,width,height);
pg.popMatrix();
pg.endDraw();

int sx = mouseX-230;
int sy = mouseY-230;
int sw = 425;
int sh = 425;

int dx = mouseX-230;
int dy = mouseY-230;
int dw = 425;
int dh = 425;

pushMatrix();
translate(mouseX, mouseY);
rotate(radians(frameCount));
translate(-mouseX, -mouseY);
copy(pg, sx, sy, sw, sh, dx, dy, dw, dh);
popMatrix();

pushMatrix();
translate(mouseX, mouseY);
rotate(radians(frameCount));
image(schatten,0,0,460,460);
image(type,0,0,550,550);
popMatrix();
}
4

0 回答 0