Combining multiple PShapes

Sorry in advance if I’m asking in the wrong forum or doing anything wrong, I’ve only been at this for a couple weeks. It’s for a school assignment I’m stuck on for days already so I thought it’s time to ask for help.

I’m trying to make the image I drew with multiple primitive shapes “expand” from the center of the screen, growing bigger and bigger until it covers the entire screen. So the problem is, the image is drawn with primitive shapes and I can’t figure out how to expand it while keeping it proporsional.

I have tried multiple ways, and is currently trying to “combine” the image with PShape before expanding it, like so:

face = createShape ();
face.beginShape ();
face.noStroke ();
face.fill (242, 179, 20);
face.rect (100, 80, 180, 200, 100);

face.noStroke ();
face.fill (255, 255, 255);
face.ellipse (150, 170, 70, 70);
face.ellipse (230, 170, 70, 70);

face.noStroke ();
face.fill (50, 50, 50);
face.ellipse (160, 170, 20, 20);
face.ellipse (220, 170, 20, 20);

face.noStroke ();
face.fill (250, 78, 90);
face.arc (190, 210, 30, 30, 0, PI);

face.noStroke ();
face.fill (255, 255, 255);
face.rect (175, 205, 30, 5);

face.endShape (CLOSE);

The end result is error messages such as 'The function rect(int, int, int, int, int) does not exist, even though it shows just fine when I try it without PShape.

I’m not looking for a complete code or anything, just a pointer on where I went wrong? Thank you in advance!

Hello,

You may glean some insight from:
https://processing.org/tutorials/pshape/

Examples in the PDE:

And all the other resources…

One of the best tools in a programmer’s tool chest is knowing the resources available to you and learning to navigate, filter, and use them.

A short list of resources to peruse:

Resources < Click here to expand !

Explore the resources available here:

:)

1 Like

Yes see tutorial

You want to use GROUP

1 Like