0

enter image description here I use Adobe Animate, I'm not a basic coder.

I am creating an animation to understand the effect of the moon on the tide.

I manage to run: -The earth on itself indefinitely. -The moon around the earth AND at the same time on itself (we only have the same side of the moon).

For example, I use these functions:

createjs.Ticker.addEventListener("tick", revolution_moon);

function revolution_moon(){
_this.moon_bon.rotation+=-0.009164222874;
}

Per frame the moon rotates by -0.009164222874°

I would like, on the same principle, to evolve an object which goes up and down according to the number of frames. (Rise during so many frames until y=? then go down during so many frames until y=?-1 ).

Anyone have an idea?

  • If you don‘t need astronomical precision you could try with simple sine function? – Markus Aug 31 '22 at 08:00
  • Hello, Thank you for answering me. I know about astronomical precision because I gave courses in astronomical navigation for officers in charge of the watch. I'm just looking, because it's not my original job and I'm just starting out, how to tell Adobe Animate: - This object goes up so much per frame for 408 frames then goes down for 408 frames, to its original position, and so on as in a perpetual motion. Like the rising and falling tide. Cordially – Jean-François CARIOU Sep 02 '22 at 09:20
  • Does this answer your question? https://stackoverflow.com/a/18759901/18667225 Another approach would be to animate the moon with TweenJS. For all this you can find nice demos and programming examples on the createjs homepage. https://www.createjs.com – Markus Sep 02 '22 at 10:31
  • I just inserted an image at the beginning of my post. Anything green is OK. It's the part in red that I want to raise over so many frames and then lower over so many same frames, which is causing me problems. – Jean-François CARIOU Sep 05 '22 at 12:21

1 Answers1

0

According to the link that I posted in the comments and assuming that the "waving" will be somehow synchronized with the rotation you can try something like this:

createjs.Ticker.addEventListener("tick", revolution_moon);

function revolution_moon(){
  _this.moon_bon.rotation+=-0.009164222874;
  _this.mov_obj.y = Math.sin(2 * Math.PI * _this.moon_bon.rotation / 360) * 204 + 204;
}

If you need more help, please add a minimal reproducible example of your code.

Markus
  • 5,976
  • 5
  • 6
  • 21