Loading...
Logo
Processing Forum
guoyong0318's Profile
2 Posts
5 Responses
0 Followers

Activity Trend

Last 30 days
Show:
Private Message
      Hi guys,
      I'm trying to assign a mask sequence for a single image, but I don't know why I can't see animation sequence after I click RUN with the code below:

      Thanks for your help!
      1. int maxImages = 30; 
      2. int imageIndex = 0; 
      3. PImage rcolor;
      4. PImage[] images2 = new PImage[maxImages]; 

      5. void setup() {
      6.   background(125);
      7.   size(400, 400, P2D);
      8.   rcolor=loadImage("red.jpg");
      9.   for (int i = 0; i < maxImages; i ++ ) {
      10.     images2[i] = loadImage( "mask" + nf(i, 4) + ".jpg" );
      11.   }
      12. }

      13. void draw() {
      14.   image(rcolor, 0, 0);
      15.   imageIndex = (imageIndex + 1) % maxImages;
      16.   for (int i = 0; i < maxImages; i ++ ) {
      17.     rcolor.mask(images2[i]);
      18.   }
      19. }

      Hi guy,
      I'm new to precessing, I checked the example which we can assign a mask to an image but how to expand it to image sequence?
       
      here is the Alphamask example
       
      PImage img;
      PImage maskImg;
      void setup() {
        size(200, 200);
        img = loadImage("test.jpg");
        maskImg = loadImage("mask.jpg");
        img.mask(maskImg);
        imageMode(CENTER);
      }
      void draw() {
        background(map(mouseX+mouseY, 0, width+height, 0, 255));
        image(img, width/2, height/2);
        image(img, mouseX, mouseY);
      }
       
       
      Thanks