美文网首页
processing 变形球 X 极光

processing 变形球 X 极光

作者: homeless_honey | 来源:发表于2019-08-03 15:42 被阅读0次
Aurora

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))

相关文章

网友评论

      本文标题:processing 变形球 X 极光

      本文链接:https://www.haomeiwen.com/subject/cudkdctx.html