1. 发光球球
- # 发光
- index = x + y*width
- for (Blob b : blobs):
- d = dist(x, y, b.pos.x, b.pos.y)
- col += 100 * b.r / d
- pixels[index] = color(col)
- # 移动
- pos.add(vel)
- if (pos.x > width || pos.x < 0):
- vel.x *= -1
2. 背景
- # 彩色
- colorMode(HSB,360,100,100,100)
- pixels[index] = color(constrain(sum, 75, 230), 80, 100, 5)
- # 叠加背景图
- tint(255, 20)
- image(back, 0, 0)
3. 调整
- # 范围
- if ( d<random(110, 140) || (d>random(0, 30) && d<random(40, 100))):
- ke[index] = true
- # 颜色
- if (ke[index]):
- pixels[index] = color(constrain(sum, 75, 230), random(60, 100), 100, random(3, 9))
网友评论