Skip to content

Commit 9d09fce

Browse files
authored
Merge pull request #1112 from Tanaya555/main
Add files via upload
2 parents 3f3056f + 94285fa commit 9d09fce

2 files changed

Lines changed: 82 additions & 0 deletions

File tree

Javascript/Abstract/Abstract.java

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import com.thomasdiewald.pixelflow.java.DwPixelFlow;
2+
import com.thomasdiewald.pixelflow.java.fluid.DwFluid2D;
3+
import java.util.Random;
4+
5+
6+
DwFluid2D fluid;
7+
8+
9+
PGraphics2D pg_fluid;
10+
11+
public void setup() {
12+
size(800, 800, P2D);
13+
14+
DwPixelFlow context = new DwPixelFlow(this);
15+
16+
17+
fluid = new DwFluid2D(context, width, height, 1);
18+
19+
20+
fluid.param.dissipation_velocity = 0.70f;
21+
fluid.param.dissipation_density = 0.99f;
22+
23+
24+
fluid.addCallback_FluiData(new DwFluid2D.FluidData() {
25+
public void update(DwFluid2D fluid) {
26+
if (true) {
27+
Random rand = new Random(); //instance of random class
28+
int upperboundx = 800;
29+
int upperboundy = 800;
30+
31+
int int_randomx = rand.nextInt(upperboundx);
32+
int int_randomy = 500+rand.nextInt(upperboundy);
33+
int int_randomvx = rand.nextInt(upperboundx);
34+
int int_randomvy = rand.nextInt(upperboundy);
35+
float px = int_randomx;
36+
float py = height-int_randomy;
37+
float vx = (int_randomvx - int_randomx) * +15;
38+
float vy = (int_randomvy - int_randomy) * -15;
39+
fluid.addVelocity(px, py, 14, vx, vy);
40+
fluid.addDensity (px, py, 20, 0.0f, 0.4f, 1.0f, 1.0f);
41+
fluid.addDensity (px, py, 8, 1.0f, 1.0f, 1.0f, 1.0f);
42+
fluid.addDensity (100,650,50, 1.0f,1.0f,1.0f, 1.0f);
43+
44+
45+
}
46+
}
47+
});
48+
49+
pg_fluid = (PGraphics2D) createGraphics(width, height, P2D);
50+
}
51+
52+
53+
public void draw() {
54+
fluid.update();
55+
56+
57+
pg_fluid.beginDraw();
58+
pg_fluid.background(0);
59+
pg_fluid.endDraw();
60+
61+
62+
fluid.renderFluidTextures(pg_fluid, 0);
63+
64+
65+
image(pg_fluid, 0, 0);
66+
}

Javascript/Abstract/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#Abstract Art
2+
3+
4+
Library used : pixelflow
5+
6+
7+
Reference:
8+
1. https://freshfork.github.io/PixelFlow/reference/
9+
2. https://diwi.github.io/PixelFlow/
10+
11+
Prerequisite: Processing Software
12+
13+
How to Execute:
14+
1. Download the file,
15+
2. install pixelflow library
16+
3. Run

0 commit comments

Comments
 (0)