Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How can I use layer axis versus world axis to animate?

LEGEND ,
Aug 30, 2010 Aug 30, 2010

Hi all,

I'm open to alternate ways to approach this.

I'm trying to create a sphere using several images. Say, 200 images, arranged in 3d space so they face outwards and are all forming one large sphere. Pretty standard thing (like the glowing blue droid apps sphere in the android commercials, like this).

I used Red Giants PlaneSpace to quickly make a sphere. I wish to 'explode' the sphere so all pictures move away from the spheres center, but in a staggered and random way rather than all at once.

I thought this would be easier as I see each layers orientation changed each layers axis. Thus the the layers Z-axis points away from the center.

Example:

ex.jpg

I tried using a simple linear expression to update the Z axis over 20 seconds to its current position minus 2000, like this:

amt=linear(time, index, index+20, position[2], position[2] - 2000);
transform.position = [position[0],position[1],amt];

This updates the Z-axis position but it's based on the world axis (or comp axis), not the layers axis. The layer axis I refer to is the axis widget that appears when you select a 3d layer and the red/green/blue 3-way axis widget appears.

How can I get the expression to use the layers axis rather than world?

Is there another approach to this? I'm definitely not up to date on 3d trig enough to write a formula to plot a course away from a specific 3d point. Hopefully there's a simple way to do it that I overlooked.

I will add that I did tie all of the 200 pictures to a null, scaled the null and it does push all the pictures away. I also added an inverse scale expression so they stay the same size as they originally were instead of scaling up with the null. However I really want to make them explode in a random fashion rather than "all at once" and I need to get away from the null scaling concept for that to have access to each individual picture.

Thanks!

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

correct answers 1 Correct answer

Community Expert , Aug 30, 2010 Aug 30, 2010

Disconnect the layers from the null, and try this:


amt=linear(time, index, index+20, 0, -2000);
value + toWorldVec([0,0,1])*amt

Dan

Translate
Community Expert ,
Aug 30, 2010 Aug 30, 2010

Disconnect the layers from the null, and try this:


amt=linear(time, index, index+20, 0, -2000);
value + toWorldVec([0,0,1])*amt

Dan

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

Wow that works great!

Does the 0,0,1 somehow 'select' Z-axis as the candidate to receive the 'value'? I assume 'value' is a property that can be set in an expression to assign something to the property you're adding an expression to (yes I'm that new that I don't know this stuff).

I did see toComp, fromWorld, etc as methods but I didn't have any real clear explaination in the reference on implementation beyond that they exist.

Thanks very much for the help!!

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

[0,0,1] is vector pointing in same direction as the local z axis. toWorldVec() converts it to a vector in world space. "value" represents the pre-expression (i.e. keyframed or static) value of the property holding the expression (you can't alter it with the expression, you just reference it).

Dan

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

Thanks for that info!

This is a little off original topic but on the same mission: I'm trying to get them to start at random times. I think it comes down to my lack of understanding on 'when' expressions are calculated. I tried to supply a random() value to linear() but it seems every single frame these things are recalculating.

Is there a way I can generate a random number once and not every single frame so I can have each picture start at a random time?

I was trying to the effect of: linear(time,random(0,10),20,0,-2000); but that just seems to re-randomize every frame so expressions must be calculating more than once, or once per frame.

If I supply linear with static values (e.g. linear(time,0,10,0,100)) it works and will give me movement starting from second 0 moving to the value 100 over 10 seconds. If I wanted to start from a random second but always take 10 seconds, how would that work in the expression?

The idea is to get the pictures to explode in a bit of a random order which means some come before others. Maybe seeding is my issue?

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

Use seedRandom(seed,true) to generate the same sequence of random numbers on each frame. This should get you headed in the right direction:

seedRandom(index,true);
minStart = 0;
maxStart = 5;
myStart = random(minStart,maxStart);

amt = linear(time, myStart, myStart+10, 0, -2000);
value + toWorldVec([0,0,1])*amt

Dan

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 30, 2010 Aug 30, 2010
LATEST

seedRandom(index,true);
r = random(0,10);
amt=ease(time, r, r+10, 0, -2000);
value + toWorldVec([0,0,1])*amt;

I didn't even think to seed identically every time based on a unique like index.. You rock!! Thanks very much! All answers marked as helpful

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