GlennimusPrime Posted July 4, 2022 Share Posted July 4, 2022 (edited) Hello Houdini vex wizards! I'm having a lot of difficulty trying to come up with a solution for this one myself. As the title mentions, I'd like a single point to be created for just one frame and then disappear again - I would also like this to happen at random time intervals as the frame number increases. For example the point will flash on for 1 frame, then maybe nothing for 10 frames, or nothing for 2 frames, then another point flash and so on. I'm not very good with time related things in vex, but would love to learn more about random time stuff if anyone has any ideas? Edited July 4, 2022 by GlennimusPrime Quote Link to comment Share on other sites More sharing options...
PixelNinja Posted July 4, 2022 Share Posted July 4, 2022 (edited) You could use a switch sop with your point plugged into the first input and a null plugged into the second input. Then an expression in the switch like: rand($F)>0.1 Which will make the point appear on roughly one out of every 10 frames. Edited July 5, 2022 by PixelNinja Quote Link to comment Share on other sites More sharing options...
Ziyad Posted July 4, 2022 Share Posted July 4, 2022 Alternatively you can also use this code in sop level. Use the parameters to specify the min/max frame intervals. Quote Link to comment Share on other sites More sharing options...
GlennimusPrime Posted July 4, 2022 Author Share Posted July 4, 2022 Beautiful! This is exactly the sort of control I was after, thank you @Ziyad! Thanks for your input too @PixelNinja, although this method does not keep the point active for just one frame at a time. Quote Link to comment Share on other sites More sharing options...
animatrix Posted July 5, 2022 Share Posted July 5, 2022 A similar method if you want to add a chance parameter: if ( @Frame >= chi("start") && @Frame <= chi("end") ) { if ( rand ( @Frame + ( ch("seed") + 3145.5672 ) * 5463.4573 ) < ch("chance") ) addpoint ( 0, 0 ); } Quote Link to comment Share on other sites More sharing options...
PixelNinja Posted July 5, 2022 Share Posted July 5, 2022 11 hours ago, GlennimusPrime said: Beautiful! This is exactly the sort of control I was after, thank you @Ziyad! Thanks for your input too @PixelNinja, although this method does not keep the point active for just one frame at a time. Apologies, the expression should have been greater than rather than less than. I edited the original response. Note that this doesn't explicitly stop a point appearing on sequential frames, though that is unlikely for small chance values. A value of 0.1 means the point will appear on roughly 1 out of every 10 frames. Just posting this for completeness as a simpler counterpoint to the vex approach. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.