Last active
December 5, 2021 22:26
-
-
Save SarahAlsharif/798c5e489c075e773fd97a2ac57ba148 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct FireworkParticlesGeometryEffect : GeometryEffect { | |
var time : Double | |
var speed = Double.random(in: 20 ... 200) | |
var direction = Double.random(in: -Double.pi ... Double.pi) | |
var animatableData: Double { | |
get { time } | |
set { time = newValue } | |
} | |
func effectValue(size: CGSize) -> ProjectionTransform { | |
let xTranslation = speed * cos(direction) * time | |
let yTranslation = speed * sin(direction) * time | |
let affineTranslation = CGAffineTransform(translationX: xTranslation, y: yTranslation) | |
return ProjectionTransform(affineTranslation) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think the CGAffineTransform want CGFloat arguments, but the compiler is providing Double. Try this: