ikoon Posted September 26, 2017 Share Posted September 26, 2017 I would like to define custom vex function and use it in my wrangles. It will just return interpolated 0-1 value, a fade in a time range. My problem is, that I would like to define it in a duplicate way (and that I am too newbie to do it). float fade(float actualtime, float fromtime, float endtime, string mode="linear") float fade(float actualtime, float fromtime, float endtime, string mode="nameofchramp") The mode="nameofchramp" ... I mean for example UI chramp name "my_bezier_ease_out". Please, can the function read from "external UI" chramp? How should I define this duplicity in the custom .h/.vfl file? I dont mind if I have to create the ramp manually. Quote Link to comment Share on other sites More sharing options...
f1480187 Posted September 27, 2017 Share Posted September 27, 2017 We can't define default parameters for non-context functions from VEX, but it is possible to workaround this too. float fade(float actualtime, fromtime, endtime) { return 444; } float fade(float actualtime, fromtime, endtime; string ramp) { return chramp(ramp, .5); } float fade(float actualtime, fromtime, endtime; string ramp) { if (ramp == "linear") return 444; return chramp(ramp, .5); } float fade(float actualtime, fromtime, endtime) { return fade(actualtime, fromtime, endtime, "linear"); } 1 1 Quote Link to comment Share on other sites More sharing options...
ikoon Posted September 27, 2017 Author Share Posted September 27, 2017 F1 you are an angel! Thank you so so so much! 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.