Redundant code for transforming grouped panels


#1

I want all my panels to do the same movement, so when clicked they would rotate. I am wondering if there is a way to make my code less redundant?


#2

Hi Outpost31,

You can use Functions to create a set of instructions which can then be called/applied multiple times. Here’s an example:

When you create a Function (I called mine “rotateGroup”), you can add a parameter of a particular type (I added a group object type and called it “group_name”) which will then be available under Data > Variables. When you call (or “apply/activate”) the function, you “feed” it a group, and it stores the group you give it in the parameter, which then gets used within the function.

You can further optimise by putting your group objects in an array and looping through the array to call the function, but with the small number of groups you have, it’s probably not worth it.

Hope that helps!

Geoff @ TechLeap


#3

That is exactly what I wanted! Thanks so much!