|
Author |
Topic: ROTATE curve (Read 374 times) |
|
kateto
|
ROTATE curve
« on: Jan 28th, 2005, 5:50am » |
|
Sorry for the double-posting, but the first one got mixed up with the smilies... -------------------------------- Hello guys, I'm new here and with proce55ing and I have a ?: I've created a smily face that I have to turn into a frowny face . What is the easiest and shortest way to rotate the mouth, if it is created with verteces and the "mouth" variables are dependent on the "head" variables? BTW, how can I fill the mouth or create a "moon" shape ) , so that I won't have to use verteces? //Mouth position dependent on head position stroke( 255, 0, 18 ); //lower lip beginShape(LINE_STRIP); bezierVertex(head_y+head_size/4.3, head_y+head_size/1.45); bezierVertex(head_y+head_size/3, head_y+head_size/1.05); bezierVertex(head_y+head_size/1.55, head_y+head_size/1.05); bezierVertex(head_y+head_size/1.28, head_y+head_size/1.45); endShape( ); //upper lip beginShape(LINE_STRIP); bezierVertex(head_y+head_size/4.3, head_y+head_size/1.45); bezierVertex(head_y+head_size/3, head_y+head_size/1.15); bezierVertex(head_y+head_size/1.55, head_y+head_size/1.15); bezierVertex(head_y+head_size/1.28, head_y+head_size/1.45); endShape( ); --------------------------------------------- One more thing: When I change the size and the position of the head, the smile changes its place and size too and on the right place. However, if I write the position like ellipse(50, 70, 120, 120); and not like ellipse(50, 50, 120, 120); the position of the smile is not where it's supposed to be. I know it has to do with the dependent vars, but I cannot seem to figure out where exactly is my error... Any advice will be of help! Thanx in advance, KaTe
|
|
|
|
st33d
|
Re: ROTATE curve
« Reply #1 on: Jan 30th, 2005, 2:47am » |
|
If you did it like this: Code: float s = 50;//size float x = 200; float y = 200; void setup(){ size(400,400); stroke( 255, 0, 18 ); strokeWeight(2); } void draw(){ smile(0, 50, 10, 30); smile(1, 50, 50, 30); smile(2, 50, 100, 30); } void smile(int c, float x, float y, float s){ if (c == 0){ //moon face beginShape(POLYGON); bezierVertex(x-(s), y); bezierVertex(x-(s), y+(s)); bezierVertex(x+(s), y+s); bezierVertex(x+s, y); endShape( ); } if(c == 1){ //smile beginShape(LINE_STRIP); bezierVertex(x-(s), y); bezierVertex(x-(s), y+(s)); bezierVertex(x+(s), y+s); bezierVertex(x+s, y); endShape( ); } if(c == 2){ //upturned beginShape(LINE_STRIP); bezierVertex(x-(s), y+(s)); bezierVertex(x-(s), y); bezierVertex(x+s, y); bezierVertex(x+(s), y+s); endShape( ); } } |
| It's pretty straight-forward. But I imagine you're trying to do something wierd and pretty by deriving your "x" co-ordinates from the y ones. It's a different approach at least.
|
I could murder a pint.
|
|
|
kateto
|
Re: ROTATE curve
« Reply #2 on: Jan 31st, 2005, 4:19am » |
|
Thanx a million st33d!!! Appreciate ur help! {} KaTe
|
|
|
|
|