고교 졸업 프로젝트에 대한 마감일이 다가오고 있으므로 조언을 해주시면 큰 도움이됩니다. 내 프로젝트는 영화를 코딩하는 것입니다. 아이디어는 처리를 사용하여 토큰과 같은 문자를 이동하고 코드를 사용하여 비와 화재 같은 것들을 애니메이션으로 만듭니다. 현재 이미지를 이동하거나 회전하는 것이 매우 어렵다는 것을 알고 있습니다. 이것은 내 프로젝트의 큰 장애물이다. 내가 가지고있는 현재 코드는 도살과 복잡하지만 여기에 있습니다. 여 주인공, 방사형의 이미지 : https://www.dropbox.com/s/x3gvendnaeftapj/radialoutlinel.png처리 중에 이미지를 회전하고 이동해야합니까?
/*
Radialrolling
*/
PImage img; // Declare variable "a" of type PImage
float ballX = 10;
float ballY = 200;
float h = 300;
//create a variable for speed
float speedY = 2; // spped set to 0 in order to test rotating. Necessary for rolling motion
float speedX = 0.;
void setup() {
size(800,800);
smooth();
noStroke();
background(0, 0, 0);// Load the image into the program
// change the mode we draw circles so they are
// aligned in the top left
ellipseMode(CORNER);
img = loadImage("radialoutlinel.png");
}
void RadialRoll(){
rotate(0);//if this is anything but 0 ball will appear of screen
image(img, ballX, ballY, h, h); //create a continuos rotation using the new fun
//nctions in the draw things
}
void draw() {
//clear the background and set the fill colour
background(0);
fill(255);
//draw the circle in it's current position
// ellipse(ballX, ballY, h,h);
//add a little gravity to the speed
speedY = speedY + 0;
speedX = speedX + .02;
ballX = ballX + speedX;
RadialRoll();
if (ballX > width - h) {
// set the position to be on the floor
ballX = width - h;
// and make the y speed 90% of what it was,
// but in the opposite direction
speedX = speedX * -1;
//switch the direction
//speedY = speedY;
}
if (ballX > width - h) {
// set the position to be on the floor
ballX = width - h;
// and make the y speed 90% of what it was,
// but in the opposite direction
speedX = speedX * -1;
//switch the direction
//speedY = speedY;
}
else if (ballX <= 0) {
// if the ball hits the top,
// make it bounce off
speedX = -speedX;
}
if (ballY > height - h) {
// set the position to be on the floor
ballY = height - h;
// and make the y speed 90% of what it was,
// but in the opposite direction
speedY = speedY * -1;
//switch the direction
//speedY = speedY;
}
else if (ballY <= 0) {
// if the ball hits the top,
// make it bounce off
speedY = -speedY;
}
}
어떻게 화면에 이미지를 이동하고 약간의 번거 로움로 회전 할 수 있습니까? 대단히 감사합니다. -TheIronHobo
rotate() 함수가 실제로 무엇을하는지 정확히 이해해야합니다. 첫 번째 중단은 Processing API 여야합니다. http://www.processing.org/reference/rotate_.html –