Skip to content

Commit d99aebb

Browse files
committed
Re-org
- Gather 3rd party sketches into their own folder. - Remove unported sketches. - Move CircleMusic and PBallDroppings out of `Demo` folder.
1 parent 7fd0c89 commit d99aebb

File tree

242 files changed

+297
-614
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

242 files changed

+297
-614
lines changed

Contributed Libraries in Python/MSAFluid/MSAFluid.pyde renamed to 3rd party/Contributed Libraries in Python/MSAFluid/MSAFluid.pyde

+4-7
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,15 @@
4242
add_library('MSAFluid')
4343
from particle_system import ParticleSystem
4444

45-
FLUID_WIDTH = 120
46-
invWidth = 0
47-
invHeight = 0
48-
fluidSolver = None
49-
particleSystem = None
5045
drawFluid = True
5146
drawSparks = True
52-
imgFluid = None
53-
aspectRatio = 0
5447

5548

5649
def setup():
50+
global invWidth, invHeight, fluidSolver
51+
global particleSystem, imgFluid, aspectRatio
5752
size(784, 484, OPENGL)
53+
FLUID_WIDTH = 120
5854
invWidth = 1.0 / width
5955
invHeight = 1.0 / height
6056
aspectRatio = (width * invHeight) ** 2
@@ -94,6 +90,7 @@ def draw():
9490

9591

9692
def mousePressed():
93+
global drawFluid, drawSparks
9794
if mouseButton == LEFT:
9895
drawFluid = not drawFluid
9996
elif mouseButton == RIGHT:

Contributed Libraries in Python/Minim/Basics/SynthesizeSound/SynthesizeSound.pyde renamed to 3rd party/Contributed Libraries in Python/Minim/Basics/SynthesizeSound/SynthesizeSound.pyde

+3-4
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ def draw():
2323
# draw the waveform of the output
2424
for i in range(out.bufferSize() - 1):
2525
line(i, 50 - out.left.get(i) * 50,
26-
i + 1, 50 - out.left.get(i + 1) * 50)
27-
line(
28-
i, 150 - out.right.get(i) * 50,
29-
i + 1, 150 - out.right.get(i + 1) * 50)
26+
i + 1, 50 - out.left.get(i + 1) * 50)
27+
line(i, 150 - out.right.get(i) * 50,
28+
i + 1, 150 - out.right.get(i + 1) * 50)
3029

3130
# draw the waveform we are using in the oscillator
3231
stroke(128, 0, 0)
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
add_library('minim')
2+
3+
minim = Minim(this)
4+
5+
def setup():
6+
size(500, 200)
7+
player = minim.loadFile("chord.wav")
8+
player.play()
9+
10+
def draw():
11+
pass
File renamed without changes.
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
int frames = 120, num=20, loLimit=400, hiLimit=100, rs;
2+
float theta, sz=10, scal, edge, step;
3+
color[] palette = {
4+
#A0ECD0, #ECD893, #E7AF7E, #B78376
5+
};
6+
color f;
7+
8+
void setup() {
9+
size(500, 500);
10+
noStroke();
11+
edge=100;
12+
step=(width-2*edge)/num;
13+
}
14+
15+
void draw() {
16+
randomSeed(rs);
17+
background(#676E81);
18+
int i=0;
19+
for (int j=0; j<4; j++) {
20+
for (int x=100; x<401; x+=step) {
21+
float y = map(sin(j*PI/8+theta+(TWO_PI/num*i)), -1, 1, loLimit, hiLimit);
22+
for (int h=0; h<7; h++) {
23+
f= palette[j%4];
24+
fill(f, h*30);
25+
if (y>=hiLimit-100 && y<=loLimit) scal = map(y, loLimit-100, hiLimit, 1, 2.8-h*.3);
26+
ellipse(x, y, sz*scal, sz*scal);
27+
}
28+
fill(f);
29+
ellipse(x, y, sz, sz);
30+
i++;
31+
}
32+
}
33+
34+
theta += TWO_PI/frames;
35+
//if (frameCount<frames+1) saveFrame("image-###.gif");
36+
}
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
frames = 120
2+
Num = 20
3+
loLimit = 450
4+
hiLimit = 50
5+
diameter = 10
6+
palette = [color(160, 236, 208), color(236, 216, 147),
7+
color(231, 175, 126), color(183, 131, 118)]
8+
9+
10+
def setup():
11+
global step, theta
12+
size(500, 500)
13+
noStroke()
14+
edge = 100
15+
step = (width - 2 * edge) / Num
16+
theta = 0
17+
18+
19+
def draw():
20+
global theta
21+
background('#676E81')
22+
i = 0
23+
for color in range(4):
24+
for x in range(100, 401, step):
25+
y = map(sin(color * PI / 8 + theta + (TAU / Num * i)),
26+
-1, 1, loLimit, hiLimit)
27+
for depth in range(7):
28+
fillColor = palette[color % 4]
29+
fill(fillColor, depth * 30)
30+
if hiLimit - 100 <= y <= loLimit :
31+
scaler = map(y,
32+
loLimit - 100, hiLimit,
33+
1, 2.8 - depth * 0.3)
34+
ellipse(x, y, diameter * scaler, diameter * scaler)
35+
fill(fillColor)
36+
ellipse(x, y, diameter, diameter)
37+
i += 1
38+
theta += TAU / frames

3rd party/cp5/cp5.pyde

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Download ControlP5 from http://www.sojamo.de/libraries/controlP5/
2+
# Drop the controlP5 folder into your processing.py libraries folder.
3+
# This demo is adapted from one of the ControlP5 demos.
4+
5+
from controlP5 import ControlP5
6+
from controlP5 import Slider
7+
8+
myColor = color(0, 0, 0)
9+
hSliderVal = 100
10+
tickSlider1Val = 100
11+
tickSlider2Val = 30
12+
13+
def demo_listener(e):
14+
print(e)
15+
16+
def setup():
17+
global hSliderVal, tickSlider1Val, tickSlider2Val
18+
size(700, 400)
19+
noStroke()
20+
cp5 = ControlP5(this)
21+
22+
# add a horizontal sliders, the value of this slider will be linked
23+
# to variable 'hSliderVal'
24+
hSliderVal = (cp5.addSlider('Horizontal Slider')
25+
.setPosition(100, 50)
26+
.setRange(0, 255)
27+
.addListener(demo_listener))
28+
29+
# create another slider with tick marks, now without
30+
# default value, the initial value will be set according to
31+
# the value of variable tickSlider2Val then.
32+
tickSlider1Val = (cp5.addSlider('Ticks Slider')
33+
.setPosition(100, 140)
34+
.setSize(20, 100)
35+
.setRange(0, 255)
36+
.setNumberOfTickMarks(5)
37+
.addListener(demo_listener))
38+
39+
tickSlider2Val = (cp5.addSlider('Ticks Slider 2')
40+
.setPosition(100, 370)
41+
.setWidth(400)
42+
.setRange(255, 0)
43+
.setValue(128)
44+
.setNumberOfTickMarks(7)
45+
.setSliderMode(Slider.FLEXIBLE)
46+
.addListener(demo_listener))
47+
48+
# add a vertical slider
49+
vSliderVal = (cp5.addSlider('Vertical Slider')
50+
.setPosition(100, 305)
51+
.setSize(200, 20)
52+
.setRange(0, 200)
53+
.setValue(128)
54+
.setSliderMode(Slider.FLEXIBLE)
55+
.addListener(demo_listener))
56+
57+
# reposition the Label for controller 'vSliderVal'
58+
vSliderVal.getValueLabel().align(ControlP5.LEFT, ControlP5.BOTTOM_OUTSIDE).setPaddingX(0)
59+
vSliderVal.getCaptionLabel().align(ControlP5.RIGHT, ControlP5.BOTTOM_OUTSIDE).setPaddingX(0)
60+
61+
def draw():
62+
background(tickSlider1Val.getValue())
63+
64+
fill(hSliderVal.getValue())
65+
rect(0, 0, width, 100)
66+
67+
fill(myColor)
68+
rect(0, 280, width, 70)
69+
70+
fill(tickSlider2Val.getValue())
71+
rect(0, 350, width, 50)
File renamed without changes.
File renamed without changes.
File renamed without changes.

nightSky/point.py renamed to 3rd party/nightSky/point.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,12 @@ def makePoint(self):
3838
return
3939

4040
def setLines(self, others):
41-
# for other in others:
42-
# if (self is not other
43-
# and dist(self.x, self.y, other.x, other.y) < Limit / 3):
44-
# lines.append(PVector(self.index,
45-
# other.index))
4641
thirdLimit = Point.Limit / 3
4742
self.lines = [other.index
4843
for other in others
4944
if (self is not other
50-
and dist(self.x, self.y, other.x, other.y) < thirdLimit)]
45+
and dist(self.startX, self.startY,
46+
other.startX, other.startY) < thirdLimit)]
5147

5248
def update(self, time, others):
5349
if self.rt:

3rd party/star/star.pde

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
//Built from scratch, but inspired by NodeBox "StarFun"
2+
3+
float b; //Base value
4+
float h; //Height value
5+
float xb; //X location first base vertex
6+
float xb2; //X location 2nd base vertex
7+
float xh; //X location height vertex, (average xb1, xb2)
8+
float yb; //Y location for both base vertices
9+
float yh; //Y location for height vertex
10+
float r; // Rotation
11+
float deg; // Degrees to radians
12+
float numStars = random(100); // Set range for number of stars
13+
float points; // Set point range on stars
14+
15+
void setup() {
16+
size (600, 400);
17+
smooth();
18+
colorMode(HSB);
19+
background(0);
20+
noStroke();
21+
//stroke(0,50);
22+
}
23+
24+
void draw() {
25+
26+
translate(width/2, height/2); //Move origin to center of window
27+
28+
//Outer loop resets conditions for each star creation
29+
for (int n =0; n < numStars; n++) {
30+
points = int(random(2,75));
31+
deg = 360;
32+
r = radians(deg/points); //Rotation in radians, converted from degrees
33+
//fill(random(255),random(255),random(255),random(50,100)); //RGB all random
34+
fill(random(204,255),random(100,255),random(51,153),random(10,25)); //HSB modified from NodeBox
35+
//Turn opacity way down for very cool nebula effect.
36+
37+
translate(random(-100,100), random(-100,100)); //Random scatter. Turn off for starburst
38+
rotate(random(-3,3));
39+
40+
// Parameters for building an isosceles triangle
41+
b = random(1,5);
42+
h = random(500);
43+
xb = 0 - b; // Locate near origin to facilitate rotation
44+
xb2 = xb + (b * 2);
45+
xh = (xb + xb2)/2; //average distance between base points
46+
yb = 0;
47+
yh = yb - h;
48+
49+
//Inside loop makes a star from iso triangles
50+
for (int i = 0; i < points; i++) {
51+
//translate(0,10); // Just for kicks. Have fun with these values
52+
rotate(r);
53+
fill(random(255),random(255),random(255),random(15,30)); //Different RGB iso
54+
triangle(xb, yb, xh, yh, xb2, yb);
55+
}
56+
}
57+
noLoop();
58+
}
59+
void mousePressed() {
60+
background(0);
61+
loop();
62+
}
63+
64+

3rd party/star/star.pyde

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# http://www.rariora.org/galleries/processes/page.php?relay=star.pde
2+
# Built from scratch, but inspired by NodeBox "StarFun"
3+
NumStars = 100 # Set range for number of stars
4+
5+
6+
def setup():
7+
size(800, 800)
8+
smooth()
9+
colorMode(HSB, 360, 255, 255, 255)
10+
background(0)
11+
noStroke()
12+
# stroke(255)
13+
14+
15+
def draw():
16+
# Move origin to center of window
17+
translate(width / 2, height / 2)
18+
# Outer loop resets conditions for each star creation
19+
for _ in range(NumStars):
20+
numTris = int(random(2, 75))
21+
# Turn opacity way down for very cool nebula effect.
22+
# HSB modified from NodeBox
23+
fill(random(288, 360), random(100, 255), random(51, 153), random(5, 15))
24+
# Random scatter. Turn off for starburst
25+
translate(random(-400, 400), random(-400, 400))
26+
rotate(random(-3, 3))
27+
# Parameters for building an isosceles triangle
28+
tri = tuple(calcTri())
29+
# Inside loop makes a star from iso triangles
30+
for _ in range(numTris):
31+
rotate(TAU / numTris)
32+
triangle(tri)
33+
noLoop()
34+
35+
def calcTri():
36+
# Parameters for building an isosceles triangle
37+
triBase = random(1, 5)
38+
triHeight = random(500)
39+
# Locate near origin to facilitate rotation
40+
xBase1 = 0 - triBase
41+
xBase2 = xBase1 + (triBase * 2)
42+
# average distance between base points
43+
xTip = (xBase1 + xBase2) / 2
44+
yBases = 0
45+
yTip = yBases - triHeight
46+
return xBase1, yBases, xTip, yTip, xBase2
47+
48+
49+
def mousePressed():
50+
background(0)
51+
loop()

3rd party/star/star_class.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Star(object):
2+
"""A collection of a varying number of identical isoceles triangles with
3+
a common base point. This object stores its own number of triangles,
4+
position, and color"""
5+
6+
def __init__(self, numTris, fillColor, translation, rotation):
7+
# super(Star, self).__init__()
8+
self.numTris = numTris
9+
self.fillColor = fillColor
10+
self.translation = translation
11+
self.rotation = rotation
12+
self.tri = PShape()
13+
14+
def update(self):
15+
for _ in range(self.numTris):
16+
rotate(TAU / self.numTris)
17+
shape(self.tri)

0 commit comments

Comments
 (0)