Как да помогнем?

### Коментари: 3

Hi kurokami,

The Help Center is not really designed for that kind of help! However, if you send me the link to your program I will comment there and help you sort it out! I know exactly the issue you're having and I'm happy to help.

-Legolas

Try creating a separate variable for each corner of the triangle. Like this:

var corner1x

var corner1y

var corner2x

var corner2y

var corner3x

var corner3y

then do something like this:

corner1x-=1;

corner2x+=1;

corner3y+=1;

if you still need the help here it is:

Find the pivot point from where you want to zoom in/out, it might be the center of the triangle or the center of the animal, or maybe the corner of it.

For instance, if you had a face with 2 eyes like this:

// face
ellipse(200, 200, 100, 100);
//left eye
triangle(165, 200, 175, 180, 185, 200);
// right eye
triangle(235, 200, 225, 180, 215, 200);

you can use the center of the face for the pivot point, and make it x and y, and right all positions based of x and y like so:

var x = 200;
var y = 200;

// face
ellipse(x, y, 100, 100);
//left eye
triangle(x - 35, y, x - 25, y - 20, x - 15, y);
// right eye
triangle(x + 35, y, x + 25, y - 20, x + 15, y);

now you only need to create a variable that scales the image around the pivot point (x, y), I called it "sc", and multiply both the width and height of every shape and also the displacement from x or y of each position parameter like:

var x = 200;
var y = 200;
var sc = 1.00;

// face
ellipse(x, y, 100 * sc, 100 * sc);
//left eye
triangle(x - 35 * sc, y, x - 25 * sc, y - 20 * sc, x - 15 * sc, y);
// right eye
triangle(x + 35 * sc, y, x + 25 * sc, y - 20 * sc, x + 15 * sc, y);

now if you increase "sc" the image will zoom in around (x, y) (the center of my face in the case), and if you decrease it the image will zoom out.

Good luck!

Влезте в услугата, за да оставите коментар.