Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
melanieg
melanieg'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
need help for code
[1 Reply]
07-Jun-2011 04:16 AM
Forum:
Programming Questions
Hi!
im trying to make work a code in a mirror way....
i want to generate the drawing in a vertical way too.
Now it works like this:
and i want to make it work like this:
somebody knows how to make this???
it would be great to receive some help :)
this is my code:
EasingDraw[] draw1 = new EasingDraw[100];
boolean mouseDrag;
float m = 0.8; //maximus easing
float targetX, targetY;
float penX, penY, ppenX, ppenY;
void setup(){
size(600,600);
background(255);
colorMode(HSB, 360, 100, 100, 100);
stroke(random(0,359),100,100,20);
smooth();
for (int i = 0; i < draw1.length; i++) {
float e = random(0, m);
draw1[i] = new EasingDraw(e);
}
}
void draw() {
if (mousePressed == true && mouseDrag == false) {
for (int i = 0; i < draw1.length; i++) {
draw1[i].drawing();
}
}
}
void mouseDragged() {
mouseDrag = true;
}
void mouseReleased() {
mouseDrag = false;
}
class EasingDraw {
float easing;
float px;
float py;
float x;
float y;
EasingDraw(float tempEasing) {
easing = tempEasing;
}
void drawing() {
float targetX = mouseX;
x += (targetX - x)*easing;
float targetY = mouseY;
y += (targetY-y)*easing;
float d = dist(x, y, px, py);
float dx = constrain(d, 0, .5);
strokeWeight(dx);
line(x,y,px,py);
px = x;
py = y;
}
}
«Prev
Next »
Moderate user : melanieg
Forum