r/iOSProgramming • • 8d 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

Edit:

I've released the app now: https://apps.apple.com/us/app/jubs-animated-widgets/id6821070839

Thank you

11 Upvotes

27 comments sorted by

5

u/purposeful_pineapple 8d ago

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

2

u/tedmirra 8d 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/jaymakesapps 8d 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 8d 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/definitelybestguy 8d 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 8d 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 7d ago

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

1

u/tedmirra 7d ago

Thank you!

1

u/wwwery-good-apps 8d 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 7d ago

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

2

u/hamsterjedi Swift 8d ago

While the idea is great, it looks laggy as hell? ๐Ÿซ 

1

u/tedmirra 8d ago

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

2

u/wwwery-good-apps 8d ago

they are looking cool, how do you render them?

2

u/tedmirra 8d 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.

2

u/mrdzyn 5d ago

The curved-glass refraction on the snow globe is a really nice touch, and timing a winter widget app for December makes a lot of sense. โ€‹Curious how you're driving the motion within WidgetKit's timeline limits โ€” are you stepping through pre-rendered timeline entries with contentTransition / SwiftUI transitions, or using another trick? Also worth checking how it holds up in StandBy mode on a charger, since widgets get scaled up there and any subtle clipping or frame-rate stutter shows up immediately.

2

u/mauricehq 2d ago

he snow globe is a great December pick. I made a widget design that slowly thickens the longer it's been, and having the look change over time instead of just the number is my favorite kind of widget to build.

1

u/nayajunimesh 2d ago

Can I ask how you got the snow animating in the widget? Did you pre-render it as a loop?

2

u/[deleted] 8d ago

[removed] โ€” view removed comment

1

u/tedmirra 8d ago

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

Thank you

1

u/redrufie 7d ago

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

2

u/[deleted] 8d ago

[removed] โ€” view removed comment

1

u/tedmirra 8d ago

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

1

u/[deleted] 6d ago

[removed] โ€” view removed comment

1

u/AutoModerator 6d ago

Hey /u/momentpressapp, your content has been removed because Reddit has marked your account as having a low Contributor Quality Score. This may result from, but is not limited to, activities such as spamming the same links across multiple subreddits, submitting posts or comments that receive a high number of downvotes, a lack of recent account activity, or having an unverified account.

Please be assured that this action is not a reflection of your participation in our subreddit. This is simply an automated filter in place to reduce spam.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.