Suppose we have two separate images that is produced by L-System.
1- Leaf
How could I merge two images together? in the other words How i merge both rules together (i.e. appear leaf and branch together).
eyeX | float: x coordinate for the eye |
---|---|
eyeY | float: y coordinate for the eye |
eyeZ | float: z coordinate for the eye |
centerX | float: x coordinate for the center of the scene |
centerY | float: y coordinate for the center of the scene |
centerZ | float: z coordinate for the center of the scene |
upX | float: usually 0.0, 1.0, or -1.0 |
upY | float: usually 0.0, 1.0, or -1.0 |
upZ | float: usually 0.0, 1.0, or -1.0 |
What is the best way for stopping sound?
The sound is stopped but after moment the compiler shows this problem:
NegativeArraySizeException
And the program will stop ‼
secCounter = (millis()/1000);
println("Time= "+secCounter);
What code should I use to stop millis() from counting?
Hi all
How can I define that if all the bricks are removed by clicking, the new screen will appear? Can you guide me please, I’m new in processing.
This code is written by phi.lho
Thanks
final int marginX = 20;
final int marginY = 20;
final int intervalH = 10;
final int intervalV = 10;
final int nbBrickH = 4;
final int nbBrickV = 3;
class Brick
{
// Constants of the brick
final int sizeX = 30;
final int sizeY = 20;
int posX;
int posY;
color c;
public Brick(int x, int y, color bc)
{
posX = x;
posY = y;
c = bc; // brick color...
}
public void draw()
{
pushStyle(); // Avoid to alter settings of other classes (if any)
rectMode(CORNER);
noStroke();
fill(c);
rect(getX(), getY(), sizeX, sizeY);
popStyle();
}
public int getX()
{
return marginX + (intervalH + sizeX) * (posX - 1);
}
public int getY()
{
return marginY + (intervalV + sizeY) * (posY - 1);
}
public boolean isOver()
{
int x = getX();
int y = getY();
return mouseX >= x && mouseX < x + sizeX && mouseY >= y && mouseY < y + sizeY;
}
}
ArrayList<Brick> bricks = new ArrayList<Brick>();
void setup()
{
size(600, 800);
for (int i = 0; i < nbBrickH; i++)
{
for (int j = 0; j < nbBrickV; j++)
{
bricks.add(new Brick(i+1, j+1, color(55, 40 + 30 * j, 255 - 30 * j)));
}
}
}
void draw()
{
background(255);
for (Brick brick : bricks)
{
brick.draw();
}
}
void mouseReleased()
{
for (Brick brick : bricks)
{
if (brick.isOver())
{
bricks.remove(brick);
break; // Can be over only one brick
}
}
}
I created a simple animation. To animation work correctly I should use background(0) under draw().
Now I want to use this animation in main processing file. Actually this animation is a class of main file.
But if I use background in class all the background of main file will be affected. What should I do?
I want to use array List. I have an example from arrayList. But in this example they use class. But they don’t write the code that is related to it. I should make class to run this program.
But I cannot make class.