We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › LED Animation patterns
Page Index Toggle Pages: 1
LED Animation patterns (Read 1593 times)
LED Animation patterns
Sep 16th, 2009, 11:19am
 
Hi,

I am looking material related to led animation patterns, and how they are coded, like this video

youtube.com/watch?v=Kuk9aXGkSF8&feature=related

Here is a work-in-progress (messy code ahead)

homepage.ntlworld.com/ricardo.sanchez/processing/hexagon_tiles_10/

So I want to do the animations not only to change the colors but to rotate as well, in that coordinated motion

Hope this makes sense

Cheers
rS
Re: LED Animation patterns
Reply #1 - Sep 16th, 2009, 12:37pm
 
Basically, you just need to draw on a small pane, like 16x16 pixels. Then, why not stretching it to get this old-school look?
Re: LED Animation patterns
Reply #2 - Sep 17th, 2009, 2:37am
 
Hi, I am looking for something more programmatic, where I can change variables and get different animations

Cheers
rS
Re: LED Animation patterns
Reply #3 - Sep 17th, 2009, 3:01am
 
are you planning on using each of the hexagons as an led? and still rotate them? (which looks great btw)

the first problem i can see is that they are using pixels arranged as squares whereas you're using hexagons. you might have to design some hexagonal invaders.

i'd just have a large array of these invaders, drawn so they don't overlap, and animate them offscreen (how?). then have a window that moves around this large array copying the values from this window to your array of hexagonal pixels.
Re: LED Animation patterns
Reply #4 - Sep 17th, 2009, 12:21pm
 
Basically, the space invaders animation is just an image swap and translation.

The thing is - IMO - you'd better start animating a simple black and white buffer, then map the pixels onto your hexagonal checkboard.
Re: LED Animation patterns
Reply #5 - Sep 22nd, 2009, 1:05am
 
Hi antiplastik, can you explain a bit more of IMO?

Cheers
rS
Re: LED Animation patterns
Reply #6 - Sep 22nd, 2009, 4:40am
 
If you ask for the meaning of IMO, it is a variant of the well known () IMHO, meaning in general In My Opinon (the additional H standing for Humble...).
Re: LED Animation patterns
Reply #7 - Sep 22nd, 2009, 5:43am
 
First time for me!

I thought it was something like: Interface Math Operations, way off, how embarrassing...

I'm Still looking for the LED animations code!

Cheers
rS
Re: LED Animation patterns
Reply #8 - Sep 26th, 2009, 11:29am
 
quick go at this. just copies a small section of the src image to the output.

this uses a rectangular grid. because you're using a hexagonal output grid (unlike the one in the video which is also rectangular) the output will look stretched in one direction. the way around this might be to compress the input image in the same way beforehand, like an anamorphic lens.

to get the animation use two different source images and alternate between them.

(you'll need a 256x256 image as src)

// acd 2009
PImage img;
float x, y, xperiod, yperiod;
int boxSize = 32, angle;
int mult = (256 / boxSize);  // size of destination pixel

void setup() {
 size(256 + 256, 256);
 img = loadImage("invaders.png");  // 256x256
 xperiod = random(-3, 3);
 yperiod = random(-3, 3);
 frameRate(5);
}

void draw() {
 // update box pos
 angle++;
 x = 128 + 90 * cos(xperiod * radians(angle));
 y = 128 + 90 * sin(yperiod * radians(angle));
 // draw src image
 image(img, 0, 0);
 noStroke();
 // copy pixels from source to large destination image
 for (int i = 0 ; i < boxSize ; i++) {
   for (int j = 0 ; j < boxSize ; j++) {
     // get pixel color from src
     color col = get((int)x + i, (int)y + j);
     // draw rect in the same colour
     fill(col);
     // set destination pixel i, j
     rect(256 + i * mult, j * mult, mult, mult);
   }
 }
 // draw transparent box
 fill(255, 128, 128, 128);
 rect(x, y, boxSize, boxSize);
}
Page Index Toggle Pages: 1