I seem to be able to see them, but not change them in functions. Looking at the fireflies example, I’m trying to do something similar. It works, but what I’m doing doesn’t.
I’m not seeing what boneheaded mistake I’m making.
I added “flake_o” to try and sweep a white pixel through the string and nothing I’m trying seems to work. I get a white pixel at location 40 that does not move.
flake_rate = .1;
export var flake_count = 10;
export var flakes = array(flake_count) // hold indices of active flakes
export var flake_on = array(pixelCount)
export var flake_o = 40;
flake_value = array(pixelCount)
flake_dir = array(pixelCount)
for (i = 0; i < pixelCount-1; i++) {
flake_on [i] = 0;
flake_value[i] = 0;
flake_dir[i] = 0;
}
export var flake_index
for (i = 0; i < flake_count-1; i++) {
flakes[i] = floor(random(pixelCount))
flake_on [flakes[i]] = 1;
}
///////////////////////////////////////////////////////////////////////////////
export function beforeRender(delta) {
t1 = time(.15)
if(t1 == 1){
flake_on[flakes[flake_index]] = 0;
flake_value[flakes[flake_index]] = 0;
flakes[flake_index] = random(pixelCount) // pick a new pixel snowflake
flake_on[flakes[flake_index]] = 1;
flake_index = clamp(flake_index ++,0,flake_count)
flake_o = flake_o + 1;
// flake_o = clamp(flake_o,0,pixelCount)
}
}
/////////////////////////////////////////////////////////////////////////////
export function render(index) {
hsv(1,1,1)
if((index%2)){
hsv(.33,1,1)
}
/*
if (flake_on[index]==1){
hsv(0,0,abs(2*t1-1))
}
*/
if(flake_o == index){
hsv(0,0,1)
}
}