UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

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.

1      

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?

1      

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.

2      

Hacking with Swift is sponsored by RevenueCat

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

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

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

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.