示例 连接的粒子

连接的粒子

这个例子使用了两个自定义 。 Particle 类存储了位置、速度和色调。它使用当前位置和色调渲染一个圆圈,并使用当前速度更新位置。Path 类存储了从 Particle 类创建的对象数组。它渲染连接每个粒子的连接线。当用户点击鼠标时,绘图会创建 Path 类的一个新实例。当用户拖动鼠标时,绘图会在当前路径添加 Particle 类的一个新实例。

Creative Commons BY-NC-SA license badge

连接的粒子: Revised by Caleb Foss. Edited and maintained by p5.js Contributors and Processing Foundation. Licensed under CC BY-NC-SA 4.0.

You can find the code history of these examples here: pre-2023 example, 2023 code. You can suggest improvements by contributing to the current website!