Skip to content

Instantly share code, notes, and snippets.

@Inncoder
Created November 28, 2020 20:04
Show Gist options
  • Save Inncoder/ffd03d4e05344b310c58eb25f557d4fd to your computer and use it in GitHub Desktop.
Save Inncoder/ffd03d4e05344b310c58eb25f557d4fd to your computer and use it in GitHub Desktop.
30K
struct ParticleEmitter {
static var rectangle: ParticlesEmitter {
get {
let base = EmitterCell()
.content(.circle(10))
.birthRate(20)
.lifetime(14)
.velocity(CGFloat(Int.random(in: 50...100)))
.velocityRange(0)
.emissionLongitude(10)
.emissionRange(0.5)
.spin(3.5)
.spinRange(0)
.scaleRange(0.25)
.scale(0.1)
return ParticlesEmitter {
base.copyEmitter().color(UIColor(red: 0.32, green: 0.36, blue: 0.83, alpha: 1.00))
base.copyEmitter().color(UIColor(red: 0.51, green: 0.20, blue: 0.69, alpha: 1.00))
base.copyEmitter().color(UIColor(red: 0.87, green: 0.16, blue: 0.48, alpha: 1.00))
base.copyEmitter().color(UIColor(red: 1.00, green: 0.85, blue: 0.47, alpha: 1.00))
base.copyEmitter().color(UIColor(red: 0.96, green: 0.52, blue: 0.16, alpha: 1.00))
}
}
}
}
//
// ThirtyK.swift
// InstagramAnimation
//
// Created by Inncoder.
struct ThirtyK: View {
var body: some View {
ZStack {
ParticleEmitter.rectangle
.emitterSize(
CGSize(
width: UIScreen.main.bounds.width,
height: UIScreen.main.bounds.height)
)
.emitterPosition(
CGPoint(
x: UIScreen.main.bounds.width,
y: (UIScreen.main.bounds.height / 1.8))
)
.emitterShape(.rectangle)
ZStack {
RoundedRectangle(cornerRadius: 15)
.frame(width: 300, height: 220)
.foregroundColor(.blue)
.opacity(0.8)
VStack(spacing: -10) {
Text("Thank you!")
.font(
.system(size: 45,
weight: .bold,
design: .rounded))
.foregroundColor(.white)
Text("30 K")
.font(
.system(size: 120,
weight: .bold,
design: .rounded))
.foregroundColor(.white)
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment