BLACK FRIDAY SALE: Save big on all my Swift books and bundles! >>

Moving an Shape/SF Symbol along a path and leaving a trail/tracer behind it

Forums > SwiftUI

Hi All,

I can move a shape/SF Symbol along a path using Animatable Data to step long the path. That works well.

Is there a good way of leaving a tacer/trail behind the movement of the shape/symbol? I have worked out a way of doing it (drawing a trail of images along the path as the object moves), but it feels quite ineffcient.

Any ideas appreciated.

   

Thanks for the video link. Sarcasm is the lowest form of wit.

I'm not seeking a code review to make my code more efficient. I'm asking about techniques. Is there is a built in technique within SwiftUI to create tracers/trails on moving objects. Like 'Trail Renderer' on Unity for example? If not, what other techniques would be the most likely candidates to be adapted for that purpose?

   

You could look at SKEmitterNode, or the older CAEmitterLayer, for your techniques. Search for these terms in HWS, or elsewhere.

You can specify the lifetime of a particle, which usually is a sprite, therefore an image.

1      

Hacking with Swift is sponsored by RevenueCat

SPONSORED In-app subscriptions are a pain to implement, hard to test, and full of edge cases. RevenueCat makes it straightforward and reliable so you can get back to building your app. Oh, and it's free if your app makes less than $10k/mo.

Learn more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.