# How to rotate and scale a rectangle pattern?

Hello,

I would like to scale a rectangles with a curve attractor and rotate these rectangles with its own center following another attractor point.

I managed to do these independently but when I try to combine the definitions, it doesn’t work…
Does someone know what I have to change for it to work?
Any help is greatly appreciated!

Dani

Something like this?

Rectangle_ScalationandRotationWithattractor_re.gh (15.2 KB)

1 Like

Cool! Thanks so much for your help!

Almost - Is it possible to have the curve attractor only affect the scalation of the rectangles and not the rotation?
And the point attractor only affecting the rotation of the rectangles?

It looks to me like your code was already doing this correctly, except for two little things:

1. You didn’t internalize your curve param.
2. You didn’t wire your Rectangle component to the final Rot3D component.

When I fixed those two issues, I see this:

RectanglesWithAttractor_2021Oct08a.gh (16.4 KB)

Using multiple attractor points, but again, I made no functional changes to your code at all.

RectanglesWithAttractor_2021Oct08b.gh (21.0 KB)

1 Like

Rectangle_ScalationandRotationWithattractor_reV2.gh (15.5 KB)

2 Likes

That is exactly what I was searching for!
Thanks so much for your help and the explanation of the solution.
I didn’t notice that the rectangle component wasn’t wired - feels so good to have the solution now.

Have a great day!

Yeah, that is the solution I was looking for!
So interesting to see another code for the problem.
Thanks so much for your help and effort I learned a lot today.

Have good day!

Hello, does anyone know if it is it possible to have the rotation in only one direction, so that it looks more “smooth” like in this example?

I don’t want the rectangles to point all that harsh to the attractor point. How can I have more of a flow like in the example (black image)?

Yes.

Which example? The solutions that have been posted are algorithms that can be adapted - so modify them any way you like. Too many people here don’t seem to learn anything from working code unless the work done by others exactly matches every detail of their evolving “spec”.

1 Like

This might be a start for your adjustments. You could rather use 3d curve as an attractor instead of using 2d planar curve like this.