Clock widget confusion
Hi there. I am creating this clock widget where I need the sun and moon layer to rotate alternatively when time goes from 6 to 12. From 12 to 6 there's no change and so on it continues...
I've set the speed of clock based on comp duration so that I can multiply it by any number
And also I have the sun and moon in the same layer...
I'm having trouble making the sun and moon rotate correctly...
6 -12--------moon stay
Next 6-12------- moon rotate by 180 to show the sun
12-6------ sun stay
And so the loop continues..
I want it all without any keyframes..
Pls, .help me...
12-6------moon. (First frame)
6-12------- moon rotate by 180 to show the sun
12-6------ sun stay
6-12------sun rotate 180 to show the sun
And the loop goes on
THIS IS THE CORRECT ORDER
Hi, using this script by Dan Ebberts I got it kinda working the way you want to, but a little bit different. The clock works now by a slider-value, which dictates how long a 6hour cycle will take.
Expression for the minute hand:
180*12 for 6 full rotations, I was to lazy to tidy this up. I also forgot to calculate for the layer.inPoint, for example if you move your layer around on the timeline.
Expression for the hourhand:
And the most important, expression on the sun/moon-thingy:
I hope you understand evertything with my comments, but I'll attach a file as well. Now, if you want to speed up or slow down your clock animation change or animate the slider on the Null. If you feel your sun/moon rotation should be faster than a 6-hour-cycle, just divide the last rampDur in the ease by the desired amount, eg in this case by 5 to have the rotation be 1 second long. In this example I put the 1 to leave it just as it is.
I hope I could help, I definetly learned a few new things while working on this problem 😊 Thanks to Dan for his awesome expression powers, I hope its okay I borrowed from your last solution... and didnt even bother to rename the variables. Sorry!😬
Thank you soooooo much Robert and Dan for making me understand the logic behind it.
And I was ae to successfully set up the rog as I wanted. Now it can loop seamlessly based in comp duration.
The only thing is the no of cycles should be even to loop seamlessly....
Thank you guys again ....🥰🥰🥰
Here is the code
cyc =4; // should be even for a seamless loop
segDur = thisComp.duration/cyc;
rampDur = (segDur*0.5).toFixed(2);
t = time%segDur.toFixed(2);
seg = Math.floor(time/segDur);
deg = 180;