diff --git a/Sources/FabulaItemsProvider/Contributor.swift b/Sources/FabulaItemsProvider/Contributor.swift index 54aec57..a117b5e 100644 --- a/Sources/FabulaItemsProvider/Contributor.swift +++ b/Sources/FabulaItemsProvider/Contributor.swift @@ -17,7 +17,8 @@ public struct Contributor { Contributor.soccer01, Contributor.tgeisse, Contributor.henry, - Contributor.regi93 + Contributor.regi93, + Contributor.onaxiz ] public static let jasu = ContributorData(name: "jasu", location: "Korea", email: "jasudev@gmail.com", link: "https://github.com/jasudev", imageName: "jasu") @@ -25,4 +26,5 @@ public struct Contributor { public static let tgeisse = ContributorData(name: "tgeisse", location: "United States", email: nil, link: "https://github.com/tgeisse", imageName: nil) public static let henry = ContributorData(name: "henry", location: "Korea", email: "wcbe9745@naver.com", link: "https://github.com/lemona-97", imageName: nil) public static let regi93 = ContributorData(name: "regi93", location: "Korea", email: "hellgey777@naver.com", link: "https://github.com/regi93", imageName: nil) + public static let onaxiz = ContributorData(name: "onaxiz", location: nil, email: nil, link: "https://github.com/onaxiz", imageName: nil) } diff --git a/Sources/FabulaItemsProvider/Items/P287_Marquee.swift b/Sources/FabulaItemsProvider/Items/P287_Marquee.swift new file mode 100644 index 0000000..e7ac990 --- /dev/null +++ b/Sources/FabulaItemsProvider/Items/P287_Marquee.swift @@ -0,0 +1,51 @@ +// +// P287_Marquee.swift +// FabulaItemsProvider +// +// Infinite horizontal scrolling text ticker. +// + +import SwiftUI + +public struct P287_Marquee: View { + + @State private var t: CGFloat = 0 + private let text = " Fabula — SwiftUI examples " + private let blockWidth: CGFloat = 350 + + public init() {} + + public var body: some View { + ZStack { + Color.fabulaBack1 + .ignoresSafeArea() + + GeometryReader { geo in + let w = geo.size.width + HStack(spacing: 60) { + Text(text) + .font(.system(size: 24, weight: .medium)) + .foregroundColor(Color.fabulaPrimary) + Text(text) + .font(.system(size: 24, weight: .medium)) + .foregroundColor(Color.fabulaPrimary) + } + .frame(width: blockWidth * 2, alignment: .leading) + .offset(x: w / 2 - blockWidth / 2 - t * blockWidth) + .onAppear { + withAnimation(.linear(duration: 10).repeatForever(autoreverses: false)) { + t = 1 + } + } + } + .frame(height: 60) + .clipped() + } + } +} + +struct P287_Marquee_Previews: PreviewProvider { + static var previews: some View { + P287_Marquee() + } +} diff --git a/Sources/FabulaItemsProvider/ItemsProvider.swift b/Sources/FabulaItemsProvider/ItemsProvider.swift index 334791b..166f6cc 100644 --- a/Sources/FabulaItemsProvider/ItemsProvider.swift +++ b/Sources/FabulaItemsProvider/ItemsProvider.swift @@ -27,7 +27,15 @@ public class ItemsProvider { public init() {} public var items: [ItemData] { - [ ItemData(id: 286, category: .study, + [ ItemData(id: 287, category: .uiux, + section: "Animation", + createDate: "2025-02-10", + title: "Marquee", + caption: "Infinite horizontal scrolling text ticker", + creator: Contributor.onaxiz.name, + tags: "marquee, text, animation, scroll", + view: FAnyView(P287_Marquee())), + ItemData(id: 286, category: .study, section: "Animation", createDate: "2025-07-20", title: "Parallax Poster",