curve a line with vex ramp: how?

   5440   5   1
User Avatar
Member
1004 posts
Joined: April 2017
Offline
Hi!

I've got a line on x with a bunch of points. I wanted to make that line curve upward by using a ramp in the Attribute Wrangle.

I'm trying to use the chramp function to modify the position Y but I don't know how to use it. I was trying:

chramp(“curve”, @P.y);

But nothing happens. I'm new to Vex.

-Olivier
User Avatar
Member
1004 posts
Joined: April 2017
Offline
Ahh! ok ok.

finally wrapped my head around it (I think). I fixed it with:


f@grad = @ptnum/(@numpt*1.0);

@P.y = chramp(“fuckinramp”, @grad);

I didn't get that the second input for the chramp had to be a gradient that I input to begin with.

By the way, what's the difference between f@grad and float grad ? I've seen people define a float with float myvalue before…
User Avatar
Member
2036 posts
Joined: Sept. 2015
Offline
f@grad creates an attribute, float grad creates a ‘local’ variable.( only seen within the wrangle it's declared )
User Avatar
Member
1004 posts
Joined: April 2017
Offline
Ok, so, in other words, if I don't need this info later (after my attribwrangle), I should use float myvalue, but if I need it later, f@myvalue ?

I had a line with a gradient done with f@ and I changed it for float but the line is now black. I don't get it… can't you tell me what I'm doing wrong?


float grad = @ptnum/(@numpt-1.0);
@Cd = 0;
@Cd.g = @grad;

Thanks.

-Olivier
User Avatar
Member
2036 posts
Joined: Sept. 2015
Offline
you created the float variable ‘grad’ and assigned a value to it - but you don't use it.

You also created an attribute ‘@grad’ but did not assign a value to that, which defaults to 0.

Just adding the ‘@’ symbol to a declared local variable doesn't somehow convert the variable into an attribute.

They are two seperate entities even though they have the same spelling.
Edited by BabaJ - Feb. 21, 2018 13:17:56
User Avatar
Member
1004 posts
Joined: April 2017
Offline
Ahhh!! so I need to remove the @

float grad = @ptnum/(@numpt-1.0);
@Cd = 0;
@Cd.g = grad;

Ok! I'll use that whenever I can!

Thanks!

-Olivier
  • Quick Links