English 中文(简体)
反复 drawing开透明条块,逐渐消失
原标题:Gradual fading by drawing a transparent rectangle repeatedly
问题回答

我不敢肯定会发生什么情况,似乎好像你一样正确,如果抽取的试采分子数目超过255个,那就应该完全是白人。 不仅重划每个框架的原因(如将背景(0)线移入 draw线),而且只是提高你的甲型数值。 我认为,这条道路将给你以更大的控制。

int a;

void setup() {
  size(300,300);
  noStroke();
  frameRate(15);
  a = 0;
}

void draw() {
  background(0);
  a += 1;
  if(a<=255){
    fill(255,a);
  }
  rect(0,0,width,height);
  fill(255);
  rect(0,0,50,50); // for comparison to white
}

我做了很多挖掘,现在我完全相信说,不可能与阿尔法频道完全吻合。 然而,有一点叫亮,这样就能够加以利用。

void setup() {
  size(300,300);
  background(0);
  noStroke();
  frameRate(15);

  // White rectangle for fading comparison.
  fill(255);
  rect(0, 0, 50, 50);
}

void draw() {
  fade(10);
}

void fade(final int fadeSpeed) {
  loadPixels();
  for (int row = 0; row < height; row++) {
    for (int col = 0; col < width; col++) {
      final int pixelIndex = row * width + col;
      int pixel = pixels[pixelIndex];
      int red   = ((pixel >>> 16) & 0xFF) + fadeSpeed;
      int green = ((pixel >>>  8) & 0xFF) + fadeSpeed;
      int blue  =  (pixel         & 0xFF) + fadeSpeed;
      if (red   > 255) { red   = 255; }
      if (green > 255) { green = 255; }
      if (blue  > 255) { blue  = 255; }

      // Shift bits back into propper position and 
      red   <<= 16;
      green <<=  8;
      pixel &= 0xFF000000;  // Keep alpha bits.
      pixel |= red |= green |= blue;

      pixels[pixelIndex] = color(pixel);
    }
  }
  updatePixels();
}

与此同时,我们又不改变肤色但光明。

我发现,虽然四舍五入的差错(如果是这样的话)适用于你利用<条形码>(SUBTRACT)填满(2)/条码>)填充,在无所有其他办法的“影像”周期的情况下,逐渐达到超过许多<条码>()的衰败,同时保持了该比例(在实时绘图情况下往往至关重要)。

 // The only reasonable way to actually "fade" out the pixels.
blendMode(SUBTRACT);
fill(2);
rect(0, 0, width, height);
blendMode(NORMAL);




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签