Previous topicNext topic

time global — synchronizing animation

Questions, comments, feedback, etc.
Post Reply
mcornholio
Posts: 22
Joined: Sat Sep 09, 2017 6:57 pm

time global — synchronizing animation

Post by mcornholio »

Here' a technique i've adopted after last magic release (which allowed to use globals in expressions). Might be useful for you, fellas.

I've added a "time" global, which just has "increase: 1" in it.
That way, each expression now could know about the time passed since scene started. You should just type "time" in you expression.

Let's take this video by example: https://yadi.sk/i/eunyFePr3SAB3c

Here's the screenshot of the setup: https://yadi.sk/d/SSv1kfmD3SAB3M. You can see that i'm doing several independent animations in sync.

Let's have a closer look:
Translate has this expression: "x + ((floor(time) % 7))/1.3 -2.2" -2.2 is just a staring move to the right, irrelevant here.
Here's the point: each second (floor(time)) "((floor(time) % 7))/1.3" will add 0.76 to my x, resetting every 7 seconds (% 7).

HueSaturation has "sqrt(floor(time) * 27) * 5000 % 1" on hue. "sqrt(x * ??) * 5000 % 1" is my contolled "Random" 0-1, randomized by given seed.
So, this expression returns random from zero to one each second.
Actually, after writing this, I realized that I could just use Random + Hold(1), but I'm too lazy to make a new annotated screenshot ¯\_(ツ)_/¯

Flip H has "floor(time/7) % 2" on it's bypass which results of turning on-off every 7 secons.

Trails has "if ((time % 7 < 0.1), 1, 0)" on bypass which will return 0 for 0.1 second every 7 seconds. This bypass will reset the trails we've created. I'm using 0.1sec here instead of time % 7 == 0 to mitigate the frame gap. If you need more precise timers, use 1/(your minimal FPS).

I hope, this'll ease up your tasks a bit.

P.S. If you'll start to use this technique, remember to hid Cmd-E to synchronize your timers.
P.P.S. Eric, you can see that I've got some magic constants around my scene. It would be very cool to have "scene locals" and/or "scene parameters" that would cure this (viewtopic.php?t=1130))
Post Reply