'Morphing' max objects
I’ve written a script which attaches to objects and animates any changes to their location, width & height. This could prove useful for patches that wish to conserve space until a certain event occurs, adding space only when necessary. But there seems to be an odd issue with faster animation speeds…
Just wondering if anyone is able to figure out why? Project attached.
-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 958.3ocyXtzSaCDDG+bxmhoVUBUoPpeDSH8.pb.5o9Ps8VUEZi8DXA6ci7tA nEw28tObLlGN10wX.oPj20Y1Y+8e1YF6aFNvYN+ZT3.e.9ELXvMCGLvLjdfA 4WOvIkbcTBQXtMmkDFl3LxNykjLFIEuaB20yPOkwyvnDZzE5Y8xGdYFJPljH ob1Ip4k1k1yeb3HHv2er6H0E6W7E767eHaUJkkfRQYqoFjuRtdT20qAQFcFk c5+k8K6XkWBZrYywme9td9N5wtc3P8+F0PdEwSSUFdMWj30FexIb76fitVAs 32GwYxLRjDHvB7JHUANPRSQAH4f.UWbFBKy3ySvz01IgxvH9JlwX9OEcex6X gZoDz+ZTLOMMZfr3EZ40LC8BlzwpxFLeSDkhHN8VqHX7vLJIoKkqIJ45vERL CPino1I4xkUoTCAq0wGL2HHgek5GpUQBilZ1N.koL1kjDiFySQoFNvbTcuJj .69f+N3IE9I0J7S1Bge1dVgIP+0d9crtWs0afrOoeTce8gzu7yi9N7sR9D7Y dL9l23rEnMbuRw79tcLZq15M.s99cKaY3UJy9HzlvIwpCGBHvsFP1.h3UMQ7 CC0TXlIIyzYOhHk24Edh0zx+rDsFwwo396HnrJcNl0tHn7cjWfYKE51lPH+Z AV0luIYkmUIIo5iYfybB6zMB0BGLSMtJU4IHinJ.Zh+aAv0gZjSwGEFJP4gp bx+XIhwva8Zoh3lSIakLWK.qr8E++6X3ZseSzjo8VzcUoS8ToS+DWUvamutT 6oBX2CfioInN85BLCYQnX73w6XJmRhUe.ENNSWizzd4ET43yEOYovfZKEFrE 4qK2hxjttuzJMdST0v9oRXfR5NllY5EUfP9wIgpMFfmE21TY18+zm0hgS2lh gdAcKdqJMjB6KUmC1FJlmcHzuiS9Tm0aBE85uBq2qaixOe5Bwin9hLdp3Ooy 4IOqsfjSvo1VPB1TKHydg.UARNWTNSK7QfrRxuRum.u9.R19M7B2XiZ62NJk OifbIFehxNp09DhTlQmuRZeIHCJf0F57vR5t6ju8gFa4Q+ISK0YPXPWe1uNy 2fC+8WaGUgX6Sr2N.O6d.vsi4acVuA3M7EGuTFskQu6MoTok.6aCp6facVuA vMXqgq41Lcp9f2xpwg0ieehK3qxhVuH445f674XTHorBW9WEUMJcOmQiiQV4 dihoBcFr3pe3ol5MSaf2reu4Mgup7lfWUdi9kYTq630eQNOXopvel1e9yqqP YcKxOatC76g2N7e.nZhK1A -----------end_max5_patcher-----------
It works perfectly fine until the animation interval is set to anything below 15. I’ve tried all sorts of ways to figure this out, but I can’t make any sense as to why it only works above an interval of 15. The closest guess I had was that the animation event was firing before the previous one had time to finish, but the code I wrote to catch this appears to disprove this theory.
A great alternative would be a method that could asynchronously delay the animation’s frame rate. But I can’t find any topics on this. It seems once a script method is called, the thread focuses on the script until it returns execution to the patch. But if there is a way around this, it’d be just as helpful to know about!
Can you please describe the behavior? I’ve set it up on mine, and the only difference between animations is the speed. Explaining the problem would possibly help me see it. Nothing appears to be wrong.
Also, details about OS, etc. can’t hurt.
Max 6, OSX 10.6.8 Lion
Steps to reproduce behavior:
Set the animation interval to 25 or so then expand 3 times, and then compress 3 times. Works fine.
Then set the animation interval to 1 and expand 3 times, then compress 3 times.
You’ll notice that the animations end prematurely and go out of control, sometimes even allowing the user to compress more than the maximum allowed compressions.
I read that the Task() object shouldn’t be used for time-critical operations (such as sample-accurate audio processing), but since this is all just sequential eye-candy, the only thing that this should effect is a slight *delay* between animation frames, not the opposite. So I don’t believe this to be the culprit, but I can’t figure out what is.
I could reproduce the problem you described. I could not figure out why this problem occurs. But I have attached my version of the patch which seems to be working alright. My guess is that the problem may be that the Task object at some point sends requests for updates faster than the execution time of the functions it is calling.