Jump to content

Help Needed For An Expression


Andz

Recommended Posts

Hi guys,

Im just finishing um my file for the 42 contest and want to have the fewest keyframes as possible. So I want to write the following expression on the center field of an object.

on first frame be at 0, on last frame be at 60 then interpolate linearly all the in-between :-)

Does that make sence? Can any one transate it for me? :rolleyes:

Actually, the number 60 is coming from another place, that is why Id like to avoid keyframe.

Thank you,

Link to comment
Share on other sites

Hi guys,

Im just finishing um my file for the 42 contest and want to have the fewest keyframes as possible. So I want to write the following expression on the center field of an object.

on first frame be at 0, on last frame be at 60 then interpolate linearly all the in-between :-)

Does that make sence? Can any one transate it for me? :rolleyes:

Actually, the number 60 is coming from another place, that is why Id like to avoid keyframe.

Thank you,

22775[/snapback]

Not quite sure what you mean....If you just want to reduce a bunch of keyframes you can use the chrefit hscript command.....

If you want to be more specific without revealing what your entry is, you can send me a PM with some more details. :)

Link to comment
Share on other sites

Not quite sure what you mean....If you just want to reduce a bunch of keyframes you can use the chrefit hscript command.....

If you want to be more specific without revealing what your entry is, you can send me a PM with some more details.  :)

22776[/snapback]

Hi Wolf no problem on revealing. Let me try to explane with more steps.

- I have a grid, that is 60 units wide

- then a GroupOp that is on box selection mode referencing the grid size so, is also 60 units wide... selecting all points,

- What I want is to have that box at the center of the grid on the first frame (lets call it $F0) and on the last frame ($Fn) the selection box should be 60 units from the grid's center... so is not selecting anything now.

What I meant by not key frame it, is that i just want to chage the grid size, and de box selection will always now how many units it has to move... no metter the grid size or the amount of frames on my animation.

Link to comment
Share on other sites

Hi Wolf no problem on revealing. Let me try to explane with more steps.

- I have a grid, that is 60 units wide

- then a GroupOp that is on box selection mode referencing the grid size so, is also 60 units wide... selecting all points,

- What I want is to have that box at the center of the grid on the first frame (lets call it $F0) and on the last frame ($Fn) the selection box should be 60 units from the grid's center... so is not selecting anything now.

What I meant by not key frame it, is that i just want to chage the grid size, and de box selection will always now how many units it has to move... no metter the grid size or the amount of frames on my animation.

22777[/snapback]

Still a little fuzzy...but lets try this :)

I'm putting this expression in the group's center x channel.

fit($FF,1,$FEND,1,(bbox("../grid1",D_XSIZE)+ch("./sizex"))/2)

Breaking it down,

I want the group to be in the center at the start of the animation, at the end of the animation I want it to be just out of reach of the grid.

So the channel uses a fit expression which remaps 1 to $FEND (end of your animation) to 1 to 60 ( the bbox(...)+ch("...") part just finds the "60" procedurally.)

groupMove.hip.gz

Link to comment
Share on other sites

Still a little fuzzy...but lets try this  :)

22780[/snapback]

Thank you for such a fast reply :-) That does it. so...

- $FF is first frame and $FEND is last frame ?

can you explaine to me how Fit is doing this?

Link to comment
Share on other sites

Thank you for such a fast reply :-) That does it. so...

- $FF is first frame and $FEND is last frame ?

can you explaine to me how Fit is doing this?

22782[/snapback]

The fit expression simply scales your input to a new range.

fit(val, old min, old max, new min, new max)

A real world example,

fit(.5,0,1,0,5) would equal 2.5

.5 is half way between 0 and 1, and I want to find out where .5 is if I scale my range to 0 to 5. (half way between 0 and 5 is 2.5)

So in the example above.

fit($FF,1,$FEND,1,(bbox("../grid1",D_XSIZE)+ch("./sizex"))/2)

$FF is the current frame.

1 is the start of the animation, (I could have used $FSTART instead of 1)

$FEND is the last frame of your animation.

1 is the starting value of group's box x position, (this should have been 0 for it to start right in the center but you get the idea.)

(bbox("../grid1",D_XSIZE)+ch("./sizex"))/2

This just finds out how big your grid is, plus a little extra for the size group's box

Awesome ascii art to help confuse everyone

|--*------|
oldMin val newMax

|-----*--------------|
oldMin  newVal     newMax

Link to comment
Share on other sites

Ok, as it says on your sig. I just didn't get the Jell-o part :rolleyes:

I am using the FIT on this same project but on a way different context hehe. Is past mid night and my brain went to bed an hour ago.

I'll read your post again tomorrow morning.

Thanks again for the help, and sorry for my rusty english :)

Link to comment
Share on other sites

hey andz.. just thought i'd chime in and say it's important to know that $F is the current frame, while $FF is the current floating point frame. good to know the difference between the two..

best of luck.. excited to see everyone's entries (even though i'm a loser and prob won't be able to submit one..) :D

Link to comment
Share on other sites

Thanks deecue , I ended up finding all that info today on the Help tool.

It's just incredible how our brain just completly shuts down when tired. Today I had a whole new view on the subject and came up with a more math oriented solution.

$F*(ch("../grid1/sizex")/$FEND)

I just had to tweek a little the box selection size because it is suposed to be the same size as the grid. And this way, frame 1 is a little off center, and at the last frame the box still selects the last row of points.

best of luck.. excited to see everyone's entries (even though i'm a loser and prob won't be able to submit one..)  :D

22790[/snapback]

Just throw something in there deecue I'm short on time too, and I don't have much hope since I'm still a Peon :huh: But I wish to read that book.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...