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 › Blending animated images/video
Page Index Toggle Pages: 1
Blending animated images/video (Read 159 times)
Blending animated images/video
Feb 23rd, 2009, 6:43pm
 
Hey I'm new to processing and am trying to complete a project for college. I hope to blend 2 images a bubble and a face and have them moving around the screen, eventually be able to control them using keys/mouse buttons.

PImage img1, img2 ;

 float x,y; // Variables for image location
 float rot; // A variable for image rotation
 
 void setup() {
   
   
   size(500,500);
 // load image, initialize variables
     img1 = loadImage( "face2.png");
     img2 = loadImage( "bubble.png");
     x = 0.0f;
     y = width/2.0f;
     rot = 0.0f;
 }

void draw() {
   background(255, 20,50);
   
   image(img1,x,y);// Draw image
   img2.blend(img2, x, y, 20, 50, 0, 0, 20, 50, BLUR);
   image(img2,x,y, 40,40);
   
   // Translate and rotate
   translate(x,y);
   rotate(rot);

   // Adjust variables to create animation
   
   x += 1.0;
   rot += 0.01;
   if (x > width) {
   x = 0;
  }
 }    

This is probabaly a stupid noob question, I have got a face and a live streamed video feed moving randomly around no problem but cant get the blened images to move. Any help would be much appriciated.

All the best
Eoin

Is it possible to do the same with video and an image -
eg. have a video stream blended inside an image and have them moving?
Page Index Toggle Pages: 1