summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ShowRunner.py4
-rw-r--r--fish_show.py44
-rw-r--r--fish_types.py6
-rw-r--r--sunrise.py14
-rw-r--r--webapp/app/templates/index.html18
5 files changed, 63 insertions, 23 deletions
diff --git a/ShowRunner.py b/ShowRunner.py
index 5fa46e7..61c0cf6 100644
--- a/ShowRunner.py
+++ b/ShowRunner.py
@@ -11,9 +11,9 @@ from run import server_thread, send_queue, recv_queue
def run_show():
server_thread.start()
bridge = Bridge()
- #SunriseShow(bridge, send_queue=recv_queue, recv_queue=send_queue).run(framerate=FRAME_RATE)
- #FishShow(bridge, send_queue=recv_queue, recv_queue=send_queue).run(framerate=FRAME_RATE)
TwinkleShow(bridge, send_queue=recv_queue, recv_queue=send_queue).run(framerate=FRAME_RATE)
+ SunriseShow(bridge, send_queue=recv_queue, recv_queue=send_queue).run(framerate=FRAME_RATE)
+ FishShow(bridge, send_queue=recv_queue, recv_queue=send_queue).run(framerate=FRAME_RATE)
print "done!"
run_show()
diff --git a/fish_show.py b/fish_show.py
index 6abf3bc..143cdad 100644
--- a/fish_show.py
+++ b/fish_show.py
@@ -58,7 +58,9 @@ def compute_coverage(fish, x, y):
min_y = min(max(y, fish.y), y + 1)
max_y = max(min(y+1, fish.y + fish.height), y)
coverage = (max_x - min_x) * (max_y - min_y)
- return coverage * scale * fish.alpha_at(x, y)
+ if fish.is_diamond:
+ return coverage * scale
+ return coverage * fish.alpha_at(x, y)
def pick_HSV(depth):
@@ -104,6 +106,15 @@ class FishShow(Show):
self.fishes = set()
self.tick_count = 0
self.depth = 0
+ self.send_event('disable image', {'name': 'jellyfish'})
+ self.send_event('disable image', {'name': 'dolphin'})
+ self.send_event('disable image', {'name': 'boat'})
+ self.send_event('disable image', {'name': 'nemo'})
+ self.send_event('disable image', {'name': 'dory'})
+ self.send_event('disable image', {'name': 'whale'})
+ self.send_event('disable image', {'name': 'eel'})
+ self.send_event('disable image', {'name': 'stingray'})
+ self.send_event('disable image', {'name': 'shark'})
def update(self):
event = self.recv_event()
@@ -134,6 +145,37 @@ class FishShow(Show):
if self.tick_count % self.TICKS_PER_DEPTH == 0:
self.depth += 1
print("DEPTH: ", self.depth)
+ if depth == 1:
+ """boat, dolphin"""
+ self.send_event('enable image', {'name': 'boat'})
+ self.send_event('enable image', {'name': 'dolphin'})
+ else if depth == 2:
+ """dolphin, jellyfish"""
+ self.send_event('disable image', {'name': 'boat'})
+ self.send_event('enable image', {'name': 'jellyfish'})
+ else if depth == 3:
+ """jellyfish, nemo, dory, whale"""
+ self.send_event('disable image', {'name': 'dolphin'})
+ self.send_event('enable image', {'name': 'nemo'})
+ self.send_event('enable image', {'name': 'dory'})
+ self.send_event('enable image', {'name': 'whale'})
+ else if depth == 4:
+ """nemo, dory, whale, shark"""
+ self.send_event('disable image', {'name': 'jellyfish'})
+ self.send_event('enable image', {'name': 'shark'})
+ else if depth == 5:
+ """whale, shark, stingray"""
+ self.send_event('disable image', {'name': 'nemo'})
+ self.send_event('disable image', {'name': 'dory'})
+ self.send_event('enable image', {'name': 'stingray'})
+ else if depth == 6:
+ """stingray, eel"""
+ self.send_event('disable image', {'name': 'whale'})
+ self.send_event('disable image', {'name': 'shark'})
+ self.send_event('enable image', {'name': 'eel'})
if self.depth > self.MAX_DEPTH:
+ self.send_event('disable image', {'name': 'stingray'})
+ self.send_event('disable image', {'name': 'eel'})
self.stop()
+
diff --git a/fish_types.py b/fish_types.py
index 6d24675..1f50104 100644
--- a/fish_types.py
+++ b/fish_types.py
@@ -117,7 +117,7 @@ class Dolphin(Fish):
width = 35
height = 1.5
tailThreshold = 0.7
- tailDuration = 2
+ tailDuration = 4
tailAccelMag = 0.4
gravity = C.Vector(0, -0.01)
@@ -128,11 +128,11 @@ class Dolphin(Fish):
return False
if not self.direction_fixed:
- self.tailAcceleration = self.tailAcceleration.rot2d(math.pi / 32)
+ self.tailAcceleration = self.tailAcceleration.rot2d(math.pi / 30)
self.direction_fixed = True
self.speed += self.drag * self.speed + self.gravity
- if self.y <= 0.25:
+ if self.y <= 0.4:
self.tailMoving = True
if self.tailMoveCount > self.tailDuration:
self.tailMoveCount = 0
diff --git a/sunrise.py b/sunrise.py
index ebdabde..2029175 100644
--- a/sunrise.py
+++ b/sunrise.py
@@ -139,12 +139,10 @@ def compute_coverage(fish, x, y):
def pick_ocean_HSV(sky_brightness):
"""Return a random color in an appropriate interval."""
- min_hue = 236 / 360
- max_hue = 250 / 360
- min_sat = 0.25
- max_sat = 0.6
- hue = random.random() * (max_hue - min_hue) + min_hue
- saturation = random.random() * (max_sat - min_sat) + min_sat
+ min_hue = constants.MIN_HUE
+ min_saturation = constants.MIN_SATURATION
+ hue = random.random() * (constants.MAX_HUE - min_hue) + min_hue
+ saturation = random.random() * (MAX_SATURATION - min_saturation) + min_saturation
return color.HSV(hue, saturation, sky_brightness)
@@ -160,8 +158,8 @@ def transition(start, end, step):
def random_change():
"""Return a random amount that a light should change each frame."""
- min_time = int(2 * FRAME_RATE)
- max_time = int(6 * FRAME_RATE)
+ min_time = int(constants.MIN_TIME * FRAME_RATE)
+ max_time = int(MAX_TIME * FRAME_RATE)
return 1 / random.randint(min_time, max_time)
diff --git a/webapp/app/templates/index.html b/webapp/app/templates/index.html
index 4dadb7b..a61b59f 100644
--- a/webapp/app/templates/index.html
+++ b/webapp/app/templates/index.html
@@ -43,37 +43,37 @@
<!-- Three columns of text below the carousel -->
<div class="row">
<div class="col-lg-4">
- <img id="jellyfish" onClick="clickImg(this)" class="img-circle" src="http://animalia-life.com/data_images/jellyfish/jellyfish7.jpg" alt="Generic placeholder image" width="140" height="140">
+ <img id="jellyfish" onClick="clickImg(this)" class="img-circle" src="http://i.imgur.com/wZl8BhW.jpg" alt="Generic placeholder image" width="140" height="140">
</div><!-- /.col-lg-4 -->
<div class="col-lg-4">
- <img id="dolphin" onClick="clickImg(this)" class="img-circle" src="http://kids.nationalgeographic.com/content/dam/kids/photos/animals/Mammals/A-G/bottlenose-dolphin-jumping.jpg.adapt.945.1.jpg" alt="Generic placeholder image" width="140" height="140">
+ <img id="dolphin" onClick="clickImg(this)" class="img-circle" src="http://i.imgur.com/MLP3x37.jpg" alt="Generic placeholder image" width="140" height="140">
</div><!-- /.col-lg-4 -->
<div class="col-lg-4">
- <img id="boat" onClick="clickImg(this)" class="img-circle" src="http://yachtpals.com/files/groupimages/woodduck.jpg" alt="Generic placeholder image" width="140" height="140">
+ <img id="boat" onClick="clickImg(this)" class="img-circle" src="http://i.imgur.com/ZU8sA8Z.jpg" alt="Generic placeholder image" width="140" height="140">
</div><!-- /.col-lg-4 -->
</div><!-- /.row -->
<br>
<div class="row">
<div class="col-lg-4">
- <img id="dory" onClick="clickImg(this)" class="img-circle" src="https://www.sciencenewsforstudents.org/sites/default/files/2016/06/main/articles/wt_blue_tang_dory_free.jpg" alt="Generic placeholder image" width="150" height="150">
+ <img id="dory" onClick="clickImg(this)" class="img-circle" src="http://i.imgur.com/Ky67jAq.jpg" alt="Generic placeholder image" width="150" height="150">
</div><!-- /.col-lg-4 -->
<div class="col-lg-4">
- <img id="nemo" onClick="clickImg(this)" class="img-circle" src="http://img.wallpaperfolder.com/f/63DCF495B5BC/clown-fish-75948.jpg" alt="Generic placeholder image" width="140" height="140">
+ <img id="nemo" onClick="clickImg(this)" class="img-circle" src="http://i.imgur.com/XGxdSI0.jpg" alt="Generic placeholder image" width="140" height="140">
</div><!-- /.col-lg-4 -->
<div class="col-lg-4">
- <img id="whale" onClick="clickImg(this)" class="img-circle" src="http://media-channel.nationalgeographic.com/media/uploads/photos/content/photo/2013/01/30/KillerWhale_01_BuiltForTheKillV.jpg" alt="Generic placeholder image" width="140" height="140">
+ <img id="whale" onClick="clickImg(this)" class="img-circle" src="http://i.imgur.com/s3J3Csx.jpg" alt="Generic placeholder image" width="140" height="140">
</div><!-- /.col-lg-4 -->
</div><!-- /.row -->
<br>
<div class="row">
<div class="col-lg-4">
- <img id="stingray" onClick="clickImg(this)" class="img-circle" src="http://3.bp.blogspot.com/-enlwcfp2skQ/Tlxxws9FRlI/AAAAAAAAAmg/0-TEWn8Sokw/s1600/stingray_5.JPG" alt="Generic placeholder image" width="140" height="140">
+ <img id="stingray" onClick="clickImg(this)" class="img-circle" src="http://i.imgur.com/RuOqhqh.jpg" alt="Generic placeholder image" width="140" height="140">
</div><!-- /.col-lg-4 -->
<div class="col-lg-4">
- <img id="eel" onClick="clickImg(this)" class="img-circle" src="http://blogs.courierpostonline.com/fishhead/files/2012/11/eel.jpg" alt="Generic placeholder image" width="140" height="140">
+ <img id="eel" onClick="clickImg(this)" class="img-circle" src="http://i.imgur.com/RmK7wJv.jpg" alt="Generic placeholder image" width="140" height="140">
</div><!-- /.col-lg-4 -->
<div class="col-lg-4">
- <img id="shark" onClick="clickImg(this)" class="img-circle" src="http://www.livescience.com/images/i/000/083/926/original/shark-attacks-increased-in-2015.jpg?interpolation=lanczos-none&downsize=*:1000" alt="Generic placeholder image" width="140" height="140">
+ <img id="shark" onClick="clickImg(this)" class="img-circle" src="http://i.imgur.com/6AuJ36F.jpg" alt="Generic placeholder image" width="140" height="140">
</div><!-- /.col-lg-4 -->
</div><!-- /.row -->