Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
masquetina
masquetina's Profile
1
Posts
0
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
How to integrate sound in simple ticckle exapmle?
[1 Reply]
28-Jun-2013 09:36 PM
Forum:
Programming Questions
I want to play sound also, when the mouse is over my smiley... How to do it?
(Thanks!)
String message = "☺";
float x, y;
float horisontalR, verticalR;
void setup() {
size(300, 300);
textFont(createFont("Georgia", 120));
textAlign(CENTER, CENTER);
horisontalR = textWidth(message) / 2;
verticalR = (textAscent() + textDescent()) / 2;
noStroke();
x = width / 2;
y = height / 2;
}
void draw() {
fill(205, 120);
rect(0, 0, width, height);
if (abs(mouseX - x) < horisontalR &&
abs(mouseY - y) < verticalR) {
x += random(-5, 5);
y += random(-5, 5);
}
fill(0);
text("☺", x, y);
}
«Prev
Next »
Moderate user : masquetina
Forum