Create a fully working clock using Cloudinary
Create a fully working clock using Cloudinary
Creative
Layers
Email marketing
Advanced

Ever wanted to make your very own fully operational clock? This recipe would show how to create a dynamic clock in one URL. You could then insert the URL anywhere you want and have a fully working clock image that dynamically changes with the time. This clock leverages cloudinary's Overlay and powerful user variables which allows it to show an accurate hour based on the actual time.

for a dynamic analog clock, generated with Cloudinary transformations. This clock is compiled by three individual layers - one clock face two hands. The hands angles are determined by the hour and minute variables.

Clock

https://res.cloudinary.com/demo/image/upload/$minute_50/$hour_1/$ma_$minute_div_60_mul_360/$ha_$hour_div_12_mul_360/l_clock_example:small/a_$ha_add_$ma_div_12/fl_layer_apply/l_clock_example:big/a_$ma/fl_layer_apply/w_550,h_550,c_crop/q_auto/clock_example/clock.png

The requirements are 3 images of the same size (550px in my example) - for the clock face and both hands. Note that the hands need to have a transparent background and point to 12 o'clock.

The Clock face:

The Clock face

https://res.cloudinary.com/demo/image/upload/clock_example/clock.png

The big Hand:

The Big hand

https://res.cloudinary.com/demo/image/upload/clock_example/big.png

The small hand:

The Small hand

https://res.cloudinary.com/demo/image/upload/clock_example/small.png

It gets two variables - for hours and minutes. Then, these variables will get translated to angles for the two hands. Once the hand layers are placed on top of the clock face, the end result is cropped to 550px again.

Clock

https://res.cloudinary.com/demo/image/upload/$minute_50/$hour_1/$ma_$minute_div_60_mul_360/$ha_$hour_div_12_mul_360/l_clock_example:small/a_$ha_add_$ma_div_12/fl_layer_apply/l_clock_example:big/a_$ma/fl_layer_apply/w_550,h_550,c_crop/q_auto/clock_example/clock.png