Skip to main content
Inspiring
November 23, 2016
Question

haw use 2 code loop and code motion2 ?

  • November 23, 2016
  • 1 reply
  • 716 views

hello
help me

haw use 2 code loop and code motion2

example

motion 2 script

try {

  amp = effect("Rotation - Overshoot")("ADBE Slider Control-0001") / 2.5, freq = effect("Rotation - Bounce")("ADBE Slider Control-0001") / 20, decay = effect("Rotation - Friction")("ADBE Slider Control-0001") / 20, n = 0, 0 < numKeys && (n = nearestKey(time)

            .index, key(n)

            .time > time && n--), t = 0 === n ? 0 : time - key(n)

        .time, 0 < n ? (v = velocityAtTime(key(n)

            .time - thisComp.frameDuration / 10), value + v / 100 * amp * Math.sin(freq * t * 2 * Math.PI) / Math.exp(decay * t)) : value;

} catch (e$$4) {

    value = value;

}

and use loop code

loopOut(type = "cycle", numKeyframes = 0)

This topic has been closed for replies.

1 reply

Mylenium
Legend
November 25, 2016

You can't combine these things directly. The loop would have to be built into the motion code. A workaround would be to convert the motion to keyframes and then apply the loop to the result.

Mylenium

asadssAuthor
Inspiring
November 25, 2016

hi thank you mylenium

my file example

you test file now code

how convert the motion to keyframes ?

and sent me file view me edit code

Microsoft OneDrive - Access files anywhere. Create docs with free Office Online.