Jump to content

if statement in scatter sop


logix1390

Recommended Posts

hello,

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)

 

Link to comment
Share on other sites

  • 4 weeks later...

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) {

removepoint(0,@ptnum);

}

 

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. 

 

 

 

 

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