• Global community
• Language:
• Deutsch
• English
• Español
• Français
• Português
• 日本語コミュニティ
Dedicated community for Japanese speakers
• 한국 커뮤니티
Dedicated community for Korean speakers
Exit Search
• Making a spiral of catwalks

# Making a spiral of catwalks

Explorer ,
Sep 29, 2022 Sep 29, 2022

Copied

I'm trying to make a spiral out of a catwalk element.

I'm trying to figure out if there's a way to do this with expressions.

pos=thisComp.layer(index-1).position; [pos[0]+2700,pos[1],pos[2]]

then manually added 20 degrees of y rotation working backwards from the end to the start.

then I parented the layers from the end to the start, and then adjusted the orientation of the start element.

I think what I want is some kind of expression that

1) moves the layer into position at the end of the chain

2) rotates it

So is there a way to craft an expression for step 1 than slides the layer into position along the RELATIVE x axis?  i.e given that I want my spiral to rise?

thanks!

John

TOPICS
Expressions

Views

61

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

LEGEND , Sep 29, 2022 Sep 29, 2022

You would have to convert the coordinates and rotations with toWorld() and toWorldVec() and then calculate the next position. For a helix it may generally be simpler to just use cosine and sine functions and multiply the angles linearly based on index. Could be something like this for the positions:

mSeg=thisComp.layer("Controller").effect("Segments per Round")("Slider");

mInc=thisComp.layer("Controller").effect("Increment per Segment")("Slider");

...

8 Replies 8
LEGEND ,
Sep 29, 2022 Sep 29, 2022

Copied

You would have to convert the coordinates and rotations with toWorld() and toWorldVec() and then calculate the next position. For a helix it may generally be simpler to just use cosine and sine functions and multiply the angles linearly based on index. Could be something like this for the positions:

mSeg=thisComp.layer("Controller").effect("Segments per Round")("Slider");

mInc=thisComp.layer("Controller").effect("Increment per Segment")("Slider");

mAng=Math.PI*2%mSeg;

mCen=this comp.layer("Center").transform.position;

Y=mInc*index-1;

[X,Y,Z]

For the rotation you would use the same approach like with that Y position - multiply a fixed value by index. Of course you need to create the controller with the sliders, the center Null and all that.

Mylenium

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Sep 29, 2022 Sep 29, 2022

Copied

Thanks

That may be beyond my pay grade unfortunately... but I'm going to try it...

In the meantime I tried to brute force it.  I can sort of see where the trigonometry comes in as I had to calculate my x and y displacements after positioning the first one manually...

The best I have come up with is to have an original 'neutral' element

duplicate it

orient it along z 20 degrees (so my catwalks go 'up')

slide it along x

raise it along y

then rotate on y so it curves inwards

then repeat with the added step of parenting the previous layers to the 'new' one after I duplicated it and oriented it...

but I'm off to learn how to set up sliders and controllers!  Thanks!

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Sep 29, 2022 Sep 29, 2022

Copied

I got part of the way.  At least far enough that the expression didn't have syntax errors...

I've attached the sequence if you have time to look -- the catwalks are basically just rectangular prisms.

I didn't try the rotation - probably why my catwalks just 'stacked'

thanks again

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
LEGEND ,
Sep 29, 2022 Sep 29, 2022

Copied

I may be able to set up a demo project tomorrow when I'm back at the computer. On my tablet currently. 🙂

Mylenium

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Sep 29, 2022 Sep 29, 2022

Copied

Thanks again!

It looks like a VERY elegant approach...that I don't quite understand all the pieces of.

All the best

John

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
LEGEND ,
Sep 30, 2022 Sep 30, 2022

Copied

Here's a project I hacked together. It should at least give you a grasp of some basics. As usual it could be infinitely refined and adapted to your specific needs and I would try to make it a bit more elegant by auto-calculating the angles and scaling the segments to fit without gaps. Maybe if I have a lazy evening and feel like it.

Mylenium

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Sep 30, 2022 Sep 30, 2022

Copied

Maestro!

I'm going to pore over it to see if I can make sense of it - already I was able to semi brute force a result by making a controller with sliders for each segments rotation...while I was still doing the initial position manually, it let me play with the pitch yaw and roll until I got a semi passable result.

But your project is far more interesting...

thanks!

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Sep 30, 2022 Sep 30, 2022

Copied

LATEST

That made me look up how cosine works...which funnily enough has been a semi-goal for awhile "relearn high school math"... oh the rabbit holes these expressions open up!