# Vex Expression Question

## Recommended Posts

I'm a Houdini Newbie and my first post here.  I'm following a tutorial on Pop Grains which is very good.

Tutorial is here :
https://vimeo.com/132847114 [vimeo.com]
TimeCode : 37:20

Towards the end he adds a proximity point and calculates 1000 grains to fall every frame based on the distance to the point. The expression used on the force node is :

force*=@id <(@Frame *1000);

I've been trying to get 50 grains to fall per frame until it reaches frame 50. At 50 frames and above I would like 1000 grains to start to fall per frame.

Is this possible with expressions ?

Thanks

##### Share on other sites

Hello,

I'm not very familiar with this type of code but if you replace the "1000" with a variable that change after f.50, I think i'll do the trick.

```float nb = 50;
if(@Frame > 50)
{
nb = 1000;
}
force *= @id < (@Frame * nb);```

Also, if someone could take the time to explain me this type of code I would be glad to know a bit more about it!

Gabriel

##### Share on other sites

Awesome thanks Nache for taking the time  , works great !

##### Share on other sites

Alternativly, if you want to continue the "boolean" multiplication approach, you could also write something like this:

`force *= @id < (@Frame-50)*1000 || @id < @Frame*50;`

@Nache Boolean expressions in Houdini return 0 for false and 1 for true, just what you did in the if statement. So the force just gets multiplied by the result of the expression.

## 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.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

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

×
×