resizing chop values if above threshold

Hi there,
I am trying to make an animation of a shape of instances that appears and disappears with a transition. See my attached file.

Basically I have the vertical position of the instances ty and I want to create a scale value s. If I could just do it with code I would say if ty > 2: s = 0 else s = 1.

In other words if ty is above a certain value scale goes to 0.

How do I do that with the result ending up in a chop channel called s that I can feed to my instances? I suppose I am missing something pretty basic here.
forum post.2.toe (5.48 KB)

try this:
Select CHOP → Expression CHOP → Merge CHOP

attach a select CHOP to your sopto1 CHOP; select ty in “Channel Names” and rename to s.

then attach an expression CHOP, and type in the “Expression 1” expression field

0 if me.inputVal >= 2 else 1

connect to your merge1

that should do what you are after.

Thank you - I had looked at the expression chop but couldn’t guess the right syntax, so this is very helpful

No worries.

Yes that syntax it’s a bit obscure to me as well… not sure if that’s python or some sort of local slang spoken in Expression Chops land only :slight_smile: I found it in the Operator Snippets.

also a Logic CHOP set to “Off When Outside Bounds” with Time Slice OFF might do what you are after.

give it a try and pick the most efficient or more adequate for your project.

that is normal Python. It’s just a shorthand oneliner expression for an if / else statement.

See here:
realpython.com/python-condition … y-operator

Expressions are extremely useful, but in this case, you’ll get better performance running it through the Logic CHOP (timeslice off), with the upper and lower bounds set.