2325 posts Small, but tough
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Author had a File in an Envato Bundle
  • Contributed a Tutorial to a Tuts+ Site
  • Author had a Free File of the Month
  • Bosnia and Herzegovina
  • Referred between 500 and 999 users
+4 more
EFEKT_Studio says

Hello folks,...

So, it maybe pretty simple and stupid, but I didn’t know how to move objects diagonally, but linear. If you seperate x,y,z position, you can’t grab both x,y and move them.

my x=372 my y=708

What I want to do is to slide x and so than y slides along…

I added this expression to y: transform.xPosition+336 (where the 336 is difference between these two)

Then when I slide x, it does what I want. But, is there a simple solution and am I really stupid :D

583 posts
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Most Wanted Bounty Winner
  • Author had a File in an Envato Bundle
  • Has been a member for 6-7 years
  • Referred between 100 and 199 users
  • Bought between 100 and 499 items
+4 more
flashato says

my faster answer will be to parent your layer to a null and give the null a vertical motion.
Ben will be here soon :)

2325 posts Small, but tough
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Author had a File in an Envato Bundle
  • Contributed a Tutorial to a Tuts+ Site
  • Author had a Free File of the Month
  • Bosnia and Herzegovina
  • Referred between 500 and 999 users
+4 more
EFEKT_Studio says

What you mean, vertical motion?

583 posts
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Most Wanted Bounty Winner
  • Author had a File in an Envato Bundle
  • Has been a member for 6-7 years
  • Referred between 100 and 199 users
  • Bought between 100 and 499 items
+4 more
flashato says

What you mean, vertical motion?

Sorry for my bad english.
I mean change pos on the Y axis.

2325 posts Small, but tough
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Author had a File in an Envato Bundle
  • Contributed a Tutorial to a Tuts+ Site
  • Author had a Free File of the Month
  • Bosnia and Herzegovina
  • Referred between 500 and 999 users
+4 more
EFEKT_Studio says

This is what I did. I rotated null by 45°, parented object’s x to null’s x, and object’s y to null’s y and when I move null’s x, I get the what I want. Still, I think there is an eaiser way to do this :)

2325 posts Small, but tough
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Author had a File in an Envato Bundle
  • Contributed a Tutorial to a Tuts+ Site
  • Author had a Free File of the Month
  • Bosnia and Herzegovina
  • Referred between 500 and 999 users
+4 more
EFEKT_Studio says

I mean, all I would have to do is to rotate the object’s axis by 45° but I don’t know how to do that. Actually I don’t think it’s possible.

5023 posts
  • Community Superstar
  • Elite Author
  • Community Moderator
  • Sold between 100 000 and 250 000 dollars
  • Author had a File in an Envato Bundle
  • Beta Tester
  • Has been a member for 5-6 years
+6 more
felt_tips Volunteer moderator says

Hi Efekt,

I think this is pretty simple with some simple trigonometry, but I’m not entirely sure what you’re trying to achieve. For a 45 degree angle, the code you have in your original post is perfect and as simple as it can be. Do you want the movement to be at a different angle?

Could you phrase it a bit more clearly?

f.

2325 posts Small, but tough
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Author had a File in an Envato Bundle
  • Contributed a Tutorial to a Tuts+ Site
  • Author had a Free File of the Month
  • Bosnia and Herzegovina
  • Referred between 500 and 999 users
+4 more
EFEKT_Studio says

Hi Efekt,

I think this is pretty simple with some simple trigonometry, but I’m not entirely sure what you’re trying to achieve. For a 45 degree angle, the code you have in your original post is perfect and as simple as it can be. Do you want the movement to be at a different angle?

Could you phrase it a bit more clearly?

f.

Hey Felt, maybe I didn’t explain it well, since picture is more than 1000 words…

Object has rotation values at 0, but object has a mask which gives an impression that object is z rotated by 45°. Now I want to move object in diagonal axis perfectly, like I would move it along x or y axis. I hope you understand what I mean…

117 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Greece
  • Has been a member for 2-3 years
  • Sold between 100 and 1 000 dollars
fAntasticmE says

2 keyframes or linear(time,start,end,point1,point2) would be easier. diagonial is a move described from x=y and an angle of 45 degrees but the fact that (0,0) is top left makes things complicated

1815 posts Videohive author & moderator
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Community Moderator
  • Referred more than 2000 users
  • Author had a File in an Envato Bundle
  • Most Wanted Bounty Winner
  • Contributed a Tutorial to a Tuts+ Site
+8 more
Mocarg Volunteer moderator says

Hey!

I’ve made a little project file for you :)

2 Points

  • Starting Point
  • Ending Point
  • Control

  • Percent
  • Preview

    Conclusion

  • Adjust the point, select the object layer and in the effects panel play with the “Percent” value to get it moving between the lines. :)
  • Expressions

    per = effect("Percent")("Slider");
    
    if(per <= 0) { per = 0.001; }
    
    start = thisComp.layer("Starting Point").transform.position;
    end = thisComp.layer("Ending Point").transform.position;
    
    dx = end[0] (minus) start[0]; //replace minus with the simbol, forum wont display it correctly :S
    
    dy = end[1] (minus) start[1]; //here also
    
    [dx * per + start[0] , dy * per + start[1]]
    

    This is a very simple expressions. First i calculate the difference in x and y values between the point. Then i simply multiply the values with the “Percent” and add that value to the Starting Point.

    Download

  • Download *.AEP for After Effects CS4
  • by
    by
    by
    by
    by
    by