We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, i'm loading 3 PShape moveable using the MouseFunction/Example (http://www.processing.org/examples/mousefunctions.html) and i want this elements to change tone and dimension when moved (based on the distance between each others). it's a week i'm searchin' around the web to find a solution but now i'm here asking... i tried dist but it doesn't work, and i can't imagine a way to handle this becouse my shape appear in this way:
shape(svg, bx, by, boxSize, boxSize); //same dicitures, basic script of the example
i can work on the tone using fill and on the dimension directly adding values to boxSize but i can't extract the distance value becouse of bx and by
please help me, best, Filippo
Answers
Be warned, I've never dealt w/ PShape enough yet.
Best approach would be creating a class to store all of those properties like x, y, w, h, c.
Then, use a double loop to get distance between each other and change their c fields accordingly.
The only online similar example I've got is about Dot bouncing objects which draws a line() linking them when they're close:
http://studio.processingtogether.com/sp/pad/export/ro.9s0026dE7B8v-/latest
Hi, here is an example that I hope is self explanatory, please also read the comments (I got here from another thread). The example only covers dragging of individual shapes (asked for in the other thread) but not the changes in color or dimension based on their distances - this though should be possible by extending the code given below.
Thank you so much sojamo for your help, now i'll study precisiously how did you obtain this.Your comment are very good but i'm not okay using something i did not understand totally becouse it became impossible to go further!
best, Filippo