In our survey, public scenarios like interviews and public speaking were identified as common triggers for nervousness. To combat this, we're harnessing AR technology for an immersive relaxation exercise to provide quick relief. The solution is an interactive AR game that generates a calming rainforest with visual breathing cues—bubbles that grow and shrink with the user's breaths. As the user breathes deeply, the bubbles float away and disappear, guiding the focus to a distant point and easing tension.
int airflow = 0;void setup() {
Serial.begin(9600);
pinMode(5, INPUT);
}void loop() {
airflow = digitalRead(5);
if (airflow == 0) {
Serial.println("AIR");
}
delay(500);
} xSpeed = random(-5, 5);
ySpeed = random(-5, 5);
}
import processing.serial.*;
Serial myPort;
ArrayList<Bubble> bubbles;
PImage forestImage;
int airflowCount = 0;
void setup() {
size(1500, 1500);
myPort = new Serial(this, "COM3", 9600);
bubbles = new ArrayList<Bubble>();
createNewBubble();
forestImage = loadImage("forest.jpg");
forestImage.resize(width, height);
}
void draw() {
tint(255, 150);
image(forestImage, 0, 0, width, height);
for (Bubble bubble : bubbles) {
bubble.display();
if (bubble.isVisible()) {
bubble.floatEffect();
}
}
removeInvisibleBubbles();
}void serialEvent(Serial myPort) {
String input = myPort.readStringUntil('\n');
if (input != null) {
input = trim(input);
println(input);
if (input.equals("AIR")) {
airflowCount++;
if (airflowCount == 1) {
for (Bubble bubble : bubbles) {
bubble.shrink();
}
} else if (airflowCount == 2) {
for (Bubble bubble : bubbles) {
bubble.shrink();
}
} else if (airflowCount == 3) {
createNewBubble();
airflowCount = 0;
}
}
}
}
void createNewBubble() {
bubbles.clear();
float newX = random(width);
float newY = random(height);
color newColor = color(random(255), random(255), random(255), 150);
bubbles.add(new Bubble(newX, newY, newColor));
}void removeInvisibleBubbles() {
for (int i = bubbles.size() - 1; i >= 0; i--) {
if (!bubbles.get(i).isVisible()) {
bubbles.remove(i);
}
}
}class Bubble {
float x, y;
float diameter;
float xSpeed, ySpeed;
color bubbleColor;
boolean visible;
Bubble(float tempX, float tempY, color tempColor) {
x = tempX;
y = tempY;
diameter = 400;
bubbleColor = tempColor;
visible = true;
xSpeed = random(-5, 5);
ySpeed = random(-5, 5);
}
void floatEffect() {
x += xSpeed;
y += random(-1, 1);
}
void shrink() {
diameter = max(50, diameter - 30);
} boolean isVisible() {
return diameter > 50;
}
void display() {
x = constrain(x, diameter / 2, width - diameter / 2);
y = constrain(y, diameter / 2, height - diameter / 2);
if (visible) {
noStroke();
fill(bubbleColor);
ellipse(x, y, diameter, diameter);
}
}
}