Quick question and assuming a simple answer but i'm pretty new to this.
So far my programme loops through and image and prints out the hex value of each pixel as a negative integer, it then resets when it gets to the end of the picture.
I was wondering how it would be best to link the integer value to a simple audio tone using minim, where the pitch of the tone gets higher or lower depending on the colour?
Hi, im new to the forum and processing so bare with me.
Im trying to get an array of arrows to move across the screen, so far i can only get one column to do so and i think ive gone the wrong way about doing it...
Any help would be very very appreciated!
here is my code:
PImage arrow;
Cell[][] grid;
// Number of columns and rows in the grid
int cols = 12;
int rows = 16;
void setup() {
size(480, 320);
grid = new Cell[cols][rows];
arrow = loadImage("arrow.png");
for (int i = 0; i < cols; i ++ ) {
for (int j = 0; j < rows; j ++ ) {
// Initialize each object
grid[i][j] = new Cell( i*20, j*20, i + j);
}
}
}
void draw() {
background(0);
for (int i = 0; i < cols; i ++ ) {
for (int j = 0; j < rows; j ++ ) {
// Oscillate and display each object
grid[i][j].update();
grid[i][j].display();
}
}
}
class Cell {
float x, y; // x,y location
float s;
// Cell Constructor
Cell( float tempX, float tempY, float speed) {
x = tempX;
y = tempY;
s = speed;
}
void update() {
s++;
if (s>480) {
s=0;
}
}
void display() {
stroke(255);
fill(255);
//can only add in 2 values, x,y produces array of arrows but with no movement