r/iOSProgramming • • 1d ago

Article I am creating animated widgets.

Hey all!

I’m building Jubs, an app with animated iPhone widgets.
I want them to feel alive, and a big part of that is getting the little details right.

I draw everything by hand first, then write simulations to figure out how it should move.
For this snow globe, that meant working out how snow falls and how the curved glass bends what you see through it.

Let me know your thoughts, please.

Thank you

8 Upvotes

22 comments sorted by

2

u/jaymakesapps 1d ago

Simulating how curved glass bends the snow for a home screen widget is a beautifully unhinged amount of effort. Good timing on the snow globe though, December basically sells it for you.

1

u/tedmirra 1d ago

Thank you, it took me several attempts to get to this point, and I am not 100% fully happy with it...

I hope you are right on the selling part šŸ™

2

u/brkaydev 1d ago

Worth checking it in the tinted and clear home screen styles too. There the system renders widgets in accented mode, and a hand drawn image can end up as a flat grey shape unless you set widget accented rendering mode on it (full color or desaturated) and pick which layers take the accent. Snow and glass highlights are exactly the kind of detail that disappears in that mode.

1

u/tedmirra 1d ago

oh!! Great catch!! Yes, I need to check that too.
Thank you

2

u/purposeful_pineapple 1d ago

Why does the box go all around the tree, but the candy cane just bobs to the side without ever crossing the front?

1

u/tedmirra 1d ago

I thought about it, and I accept it, but now that you mention it, it makes sense for them to go around and maybe touch each other.

2

u/definitelybestguy 1d ago

I can see you've tried this on device, but curious how long you've run it for? I suspect this kind of refresh rate will consume your widget's day's refresh budget in minutes, and then it will end up sitting static the rest of the time... Would love to be wrong about this as I've had a few ideas which would benefit from even this 1 fps refresh rate animation, but I didn't think it was possible.

1

u/tedmirra 1d ago

It works all day; everything here is like a clock. Imagine the pointers are the gift, candy cane and snow.

You can try the V1 here: https://apps.apple.com/us/app/jubs/id6821070839

2

u/definitelybestguy 10h ago

Well, just as I said, I'm loving being wrong about this! Very cool, TIL!

1

u/tedmirra 4h ago

Thank you!

1

u/wwwery-good-apps 1d ago

You're right for a normal widget, that's 40 to 70 reloads a day. But reloads don't count while the app has an active audio session (it's in Apple's "Keeping a widget up to date" doc). My emulator app plays the game sound in the background and just spams reloadAllTimelines, I got up to 40 a second on the home screen and could play Mario Kart in the CarPlay dashboard widget. Phone gets warm fast though, then it drops to around 16.

1

u/definitelybestguy 10h ago

Very good to know, thanks for the tip, I'll definitely take a look into this

2

u/wwwery-good-apps 1d ago

they are looking cool, how do you render them?

2

u/tedmirra 1d ago

Its using a trick, so basically this is a clock, the pointers are the items you see, each one moving at their own time.

1

u/hamsterjedi Swift 1d ago

While the idea is great, it looks laggy as hell? 🫠

1

u/tedmirra 1d ago

Yes, unfortunately, it's a drawback... because widgets are not supposed to animate... :/

2

u/ThalesMother9938 1d ago

Baking the snow pose into the timer font is a clever way around the reload budget, since the clock keeps ticking without asking the system for a new timeline. How many frames did you manage to pack into the font before the file got too heavy, and how long is the loop before the snow repeats?

2

u/[deleted] 1d ago

[removed] — view removed comment

1

u/tedmirra 1d ago

This is a good point! I need to check this out!

Thank you

1

u/redrufie 11h ago

Wasn't there a leaked function that wouldn't hurt battery life too much