Skip to main content
Participant
November 24, 2022
Question

React to beat

  • November 24, 2022
  • 2 replies
  • 353 views

Hello everyone! 

I want to create a music visualizer, and I use this guide as a starting point http://www.motionscript.com/design-guide/audio-count.html . Everything works fine, but I want to improve it and don't know how.

 

I have a line which is animated by a trim path from start to the end (it's looped) . I need that my animation starts from the beginning every time it will be reacting to the beat. After animation is done (35 frames) it will go to 0 opacity/or end the animation by time remapping (i don't know how to do it). This has to apply for every compositions (in my case 6) 

 

1st beat start animation of 1st shape starts, 2nd beat starts the 2nd shape animation ..... 7th beat starts the animation of the 1st shape, etc...

 

I added a polystar for example just for better understanding and visibility 🙂


This topic has been closed for replies.

2 replies

Dan Ebberts
Community Expert
Community Expert
November 24, 2022

Try turning on time remapping for your 6 comp layers, and applying this time remapping expression to each:

n = 6;
slider = thisComp.layer("control").effect("Slider Control")("Slider");
targetBeat = Math.floor((slider-index)/n)*n + index;
t = 0;
if (targetBeat > 0){
  f = timeToFrames(time);
  while (f >= 0){
    if (slider.valueAtTime(framesToTime(f)) < targetBeat) break;
    f--;
  }
  t = time - framesToTime(f+1);
}
t
Mylenium
Legend
November 24, 2022

You can simply "reset" the count of the n variable with a modulus (%) or some other math operation like a rounded division with an arbitrary value just like you can of course change the start count. The cide you are using is not counting time, though, so I don't understand what you are actually trying to achieve here. If things need to reset after 35 frames you don't even need an expression, you can simply animate the time remapping directly.

 

Mylenium