Jump to content

if statement in scatter sop

Recommended Posts


I am trying to write an if statement with a fit function inside a scatter sop.

Basally I want to gradually decrease points over time after a certain frame. 

I got the fit to work so that it gradually decreases over time :

fit($F, 1, 10, 14, 0)    

So this scatters 14 points and decreases over 10 frames.I got that...

now I want to be able to specify when the scatter starts

if($F>50,fit($F, 1, 10, 14, 0), 0)


Share this post

Link to post
Share on other sites

oops, i accidently sent that with out finishing...

So that if statement does not work...am i doing something wrong with the syntax?



Share this post

Link to post
Share on other sites

Hi logix1390, 


Perhaps a better way to go about this, with more control, is to have a point wrangle after your scatter sop. Deleting the points based on time, frame like you're already doing, or an attribute that you set, would be faster because vex uses your gpu!

So one way to go about this, would be to check if @Time is = to the point number, and then either give it an attribute or use the removepoint function.  

int juice = fit(@Frame, 0,10,14,0);

if (@ptnum == juice) {




or within the same if statement do > 

i@group_deleteme = 1;

and use a blast or delete node running over the group or attribute you created within your if statement after your wrangle.

This method is better in my opinion because typing everything out in one line inside of a channel box in h script can be a headache for me sometimes. Once you step outside of the scatter node into the wrangle, you can delete your points on a plethora of things now, like position or color as well as the point number or frame, possibly adding more depth to the effect you're trying to achieve. 


Yes you were using the if statement correctly, and if you're doing a one liner if statement it looks like this >

if (condition,true value, false value) 


Good luck, hope I helped. 





Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now