Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// AnimateFontWeightView.swift
// 100DaysOfSwiftUI
// Created by on 11.6.2022.
import SwiftUI
struct AnimateFontWeightView: View {
@State private var isMagicallyMoving = false
var body: some View {
Text("Animate SwiftUI Text Like Your Boss' Boss!")
.fontWeight(isMagicallyMoving ? .black : .ultraLight)
//Investigate: Animating gradient with foreground style
// The foreground color animation is new in iOS 16
.foregroundColor(isMagicallyMoving ? .indigo : .cyan)
//.animation(.easeInOut(duration: 1).delay(0.5).repeatForever(autoreverses: true), value: isMagicallyMoving)
.animation(.interpolatingSpring(stiffness: 170, damping: 15).repeatForever(autoreverses: true), value: isMagicallyMoving)
.onAppear {
struct AnimateFontWeightView_Previews: PreviewProvider {
static var previews: some View {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment