ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# another butterfly expression question

FAQ   •   VIEW ALL
 another butterfly expression question on Jan 6, 2010 at 1:24:25 am

Hi all.

I'm relatively new to expressions but an intermediate-advanced after effects user. I've dug through creative cows, Dan Ebbert's motionscript, and other sites to find a solution but haven't found one. Appologies for reposting something thats got a lot of responses already, but i appreciate everyone's input :)

I am making a large group of butterflies go from dormant (wings breathing slowly) to them all flying in a group over a matter of ~3 seconds.

I am trying to use sliders to automate:
1. how quick the wings flap
2. the range of motion they move

With these two controls i figure it would be easy to set a dormant state with the wings open but moving slowly (ie: slow flap, 10deg range), then ease out of that to a fast, full flight lifespan.

I dont know math well enough to figure this out, but when i run the code below (easing from a relaxed state to fast frequency/large amplitude) the wings go VERY fast while ramping up, then settle at the desired pace.

```freq = thisComp.layer("Null: Angle Wing Slider").effect("Frequency Slider")("Slider"); amplitude = thisComp.layer("Null: Angle Wing Slider").effect("Amplitude Slider")("Slider"); decay = 0; //no decay amplitude*Math.sin(freq*time*2*Math.PI)```

Or:

What do i modify to allow it to operate smoothly?

Thanks!

-----------------------------------------------------
Originally i had wanted to use this code (dan's) but couldn't make sense of how to get the last 2 lines to work:
``` from = -45; //one end of your oscillation to = 45; //the other end of your oscillation period = 1.5; //time between oscillation points (multiply by 2 for a round trip) t = time % (period * 2); if (t > period) t = 2 * period – t; linear(t, 0, period, from, to)```

jay

 Re: another butterfly expression questionon Jan 7, 2010 at 10:31:39 am

Jay.

One of the main reasons that i use Apple Motion for this kind of animation is that i do not have to fiddle around with math and expressions.

In apple Motion this thing would take just a few minutes to set up including the amount of flap and the flying away of the butterflies.

in motion you just need to drag some behaviors on the objects and the math is done for you.

I will try to make an example and upload it up for you.

Eyal.

Eyal Shtark
Exhibitions and Multi-Media

ISCAR LTD.
Tel. +972-4-9970371
Fax. +972-4-9970422
Email: eyal@iscar.co.il

 Re: another butterfly expression questionon Jan 7, 2010 at 12:20:12 pm

Jay

is this what you wanted to do?

http://reels.creativecow.net/film/butterflies-taking-off

Eyal.

Eyal Shtark
Exhibitions and Multi-Media

ISCAR LTD.
Tel. +972-4-9970371
Fax. +972-4-9970422
Email: eyal@iscar.co.il

 Re: another butterfly expression questionon Jan 7, 2010 at 12:21:08 pm

Jay

is this what you wanted to do?

http://reels.creativecow.net/film/butterflies-taking-off

Eyal.

Eyal Shtark
Exhibitions and Multi-Media

ISCAR LTD.
Tel. +972-4-9970371
Fax. +972-4-9970422
Email: eyal@iscar.co.il