How I mix (half red, half green and half blue) together with 50% transparency mathematically.
void draw()
{
//backgroud(0,0,0);
fill(((x+y)/100)%TWO_PI, 1, 1);
translate(x,y);
scale(s,s);
for(int k=0; k<20; k++)
{
rotate((x+y)/100.);
rotateX(x/100.);
rotateY(y/100.);
rect(0,0,100,50);
// ellipse(0,0,100,50);
}
s=s+ds;
x=x+dx;
y=y+dy;
if( s > 2 || s < 0.75) ds = -ds;
if(x <= 0 || x >= width-1) dx = -dx;
if(y <= 0 || y >=height-1) dy = -dy;
if(random(100)<3)
{
dx += random(1)-0.5;
dy += random(1)-0.5;
}
}
I know How to construct the opposite color by selecting each of the R, G, B, Channel individually and subtracting each value from 255.
But I don’t know how to obtain the mix color of two colors. In the other word assume we draw to ellipse that overlaps each other (they have alpha channel). One is red and one is green. What will the mix color of red and green?
How could I change the code to make a bouncing ball that loses some of its height with each bounce as a real ping pong ball would if it were dropped onto a hard floor?
Hi
Does translation followed by rotation have the same result as rotation followed by translation? Is that right that sometimes they have same result? Can you please justify your response for both situations?
Thanks
Hi
How can I use strokeWeight() in the following code to attenuate the branch in every level individually . I want to tree be thick in root then level by level be thin.
Hey guys
How can we showing 2-different image that using different rules on one file, to both appear in a single scene simultaneously? Suppose we have 2 rules: 1- tree, 2- snow flake
How technique can we use for showing for instance snow flake and tree together in one scene?
Rule of snow flake:
String state = "F--F--F";
String F_rule = "F+F--F+F";
There is a little difference in main code in both snow flake and tree. I just change the rule, angle, L and sometimes add d/=x under for(int K=0; K < L; K++) for decrease the size in every level.