Permalink
Browse files

Show/hide trail using the p key

  • Loading branch information...
muraliavarma committed Feb 6, 2013
1 parent 49aebb6 commit 5c0ae3a370ef7661d07e6d0f48a3782aed27f201
Binary file not shown.
Binary file not shown.
@@ -35,7 +35,7 @@
final float WANDERING_WEIGHT = 0.0002f;
int edgeBehavior = TOROIDAL_MODE;
-int backgroundAlpha = 20; //0 for full trail, 255 for no trail
+int backgroundAlpha = 10; //0 for full trail, 255 for no trail
//flock centering, velocity matching, collision avoidance, wandering force
boolean flockCenteringForce = true;
@@ -106,6 +106,17 @@ else if(key == 'w') {
}
}
+ if (key == 'p') {
+ if (backgroundAlpha == 255) {
+ //if no trail, make it full trail
+ backgroundAlpha = 0;
+ }
+ else {
+ //if some trail (between 1 and 254), make it no trail
+ backgroundAlpha = 255;
+ }
+ }
+
//forces
if (key == '1') {
flockCenteringForce = !flockCenteringForce;
@@ -20,7 +20,7 @@ final float VELOCITY_MATCHING_WEIGHT = 0.1;
final float WANDERING_WEIGHT = 0.0002;
int edgeBehavior = TOROIDAL_MODE;
-int backgroundAlpha = 20; //0 for full trail, 255 for no trail
+int backgroundAlpha = 10; //0 for full trail, 255 for no trail
//flock centering, velocity matching, collision avoidance, wandering force
boolean flockCenteringForce = true;
@@ -91,6 +91,17 @@ void keyPressed() {
}
}
+ if (key == 'p') {
+ if (backgroundAlpha == 255) {
+ //if no trail, make it full trail
+ backgroundAlpha = 0;
+ }
+ else {
+ //if some trail (between 1 and 254), make it no trail
+ backgroundAlpha = 255;
+ }
+ }
+
//forces
if (key == '1') {
flockCenteringForce = !flockCenteringForce;

0 comments on commit 5c0ae3a

Please sign in to comment.