![]() ![]() ![]() There are three things going on in the last line. All the real math happens in the last line. Variable t is used to calculate the time since the layer's In Point. The first three lines just set the parameters for the waveform: maximum amplitude of 80, frequency of one oscillation per second, and a decay (how fast the amplitude diminishes) value of one. Take a look at the basic expression for an exponentially decaying sine wave:Īmp*Math.sin(t*freq*Math.PI*2)/Math.exp(t*decay) Īs it sits, this expression will trigger a decaying sine wave oscillation at the layer's In Point. If you're tempted, please refer to my Expression Speed and Frequency Control article to see what's involved in doing it correctly. You might be tempted to simulate this bounce behavior by taking the absolute value of the oscillating sine wave (using the JavaScript Math.abs() function) and linking the frequency variable to a slider which you would keyframe to speed up. Notice that the bounces occur more frequently as the object loses energy. This waveform is generated by a bounce simulation expression. The object stops at the top of the bounce and then accelerates (due to the force of some gravity-like phenomenon), so the math involved is completely different. In fact, the bounce waveform is actually a series of parabolas of decreasing amplitude. That means a sine wave simulation is not adequate for a bounce. As the amplitude of the bounces decrease, they happen more often. When an object bounces, it loses energy on each bounce, which affects both the amplitude and the frequency. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |