# Creating an ocean simulation using PixelFlow

**URL:** <https://discourse.processing.org/t/creating-an-ocean-simulation-using-pixelflow/11020>\
**Category:** Libraries\
**Created:** [May 8, 2019, 12:44am UTC](https://discourse.processing.org/t/creating-an-ocean-simulation-using-pixelflow/11020 "2019-05-08T00:44:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BongoTurtle](https://avatars.discourse-cdn.com/v4/letter/b/df788c/32.png) [@BongoTurtle](https://discourse.processing.org/u/BongoTurtle)\
**Post date:** [May 8, 2019, 12:44am UTC](https://discourse.processing.org/t/creating-an-ocean-simulation-using-pixelflow/11020/1 "2019-05-08T00:44:55Z")

</div>

I’m trying to create an interactive desktop background using Processing and I need a simulation of a 2d ocean. The idea is for you to be able to drag on the water creating waves which will move fish. I’ve started using the PixelFlow library and the example given on the site ([https://diwi.github.io/PixelFlow/](https://diwi.github.io/PixelFlow/)), but I am finding it difficult to add a wave across the entire screen. I think a wave similar to this ([https://upload.wikimedia.org/wikipedia/commons/4/4a/Deep\_water\_wave.gif](https://upload.wikimedia.org/wikipedia/commons/4/4a/Deep_water_wave.gif)) will make it look much less still so I’d like to be able to add something like this while still keeping the base mechanics. If anyone knows how to do this easily using PixelFlow or some other library that would be great.

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [May 11, 2019, 6:05pm UTC](https://discourse.processing.org/t/creating-an-ocean-simulation-using-pixelflow/11020/2 "2019-05-11T18:05:39Z")

</div>

For implementations of a 2D ocean surface, check out these two recent threads:

> [@Water simulation updating asymetrically](https://discourse.processing.org/t/water-simulation-updating-asymetrically/10885):
>
> Hey So I have been working on simulation of water in 2 dimensions. It is comprised of nodes that are attached by “springs” to their neighbors and to the “water level”. it works fine, but it behaves differently on either side of a perturbation. I understand why, I think the updating is working twice on the next element in line (or something like that) and is effectively causing extra drag on one side. I tried some naive solutions but nothing has worked. any input is appreciated! int num\_of\_spri…

> [@Problem about creating water waves when using mass spring damper system](https://discourse.processing.org/t/problem-about-creating-water-waves-when-using-mass-spring-damper-system/3101):
>
> I got a problem when trying to make water waves.I only got one jumping surfacepoint on a still water surface. Here is the code. lake lake; void setup() { size(400, 500); lake = new lake(); } void draw() { background(255); lake.run(); } class lake{ water surfacePoints[]; int num = width; PVector position; lake(){ surfacePoints = new water[num]; for (int i = 0; i \< surfacePoints.length; i++) { surfacePoints[i] = new water(1,0.1,0.2,new PVector(i,height/2)); } } …
