dchristo Posted March 16, 2017 Report Share Posted March 16, 2017 I'm trying to write an expression to move a piece of media in increments of 10 pixels. Given a variable of 0-10, I would like output of 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, and 100. The expression I think should work is: (variable - (variable % 1)) * 10 I'll be ramping the variable, so I need to remove the decimal porition. The (variable % 1) should return only the decimal portion of the variable, and subtracting it from itself should give me integers only. I'm using this expression in the X axis of a position tween, and when I set the variable to 7.6, the tween is being set to 76 pixels, whereas I'm expecting it to be 70. Is this a bug, or am I misinterpreting how the % operator should work? Is there another way to accomplish this? Watchout 6.1.5 Production (haven't tried on a display), Win7 Thanks, --D Quote Link to comment Share on other sites More sharing options...
Mike Fahl Posted March 16, 2017 Report Share Posted March 16, 2017 try variable*10 - ((variable*10) % 10) instead. The % operator works only with integers, not with fractions. Quote Link to comment Share on other sites More sharing options...
dchristo Posted March 17, 2017 Author Report Share Posted March 17, 2017 Thanks, Mike. This mostly works; however, when ramping the input (for example, over 5 seconds), the media jitters back and forth a couple of pixels before in between big jumps. --D Quote Link to comment Share on other sites More sharing options...
Mike Fahl Posted March 18, 2017 Report Share Posted March 18, 2017 Should have nothing to do with the above formula as far as I can tell. Where's the input variable coming from? Most likely, there's some "jitter" here. Quote Link to comment Share on other sites More sharing options...
dchristo Posted March 24, 2017 Author Report Share Posted March 24, 2017 Using the setInput command to ramp over a period of time: setInput myVariable 10 5000 --D Quote Link to comment Share on other sites More sharing options...
Mike Fahl Posted March 26, 2017 Report Share Posted March 26, 2017 I see no reason why a plain fade to value should result in "jitter". You may want to bring this up with support. Mike 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.