<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.tiffa.net/w/index.php?action=history&amp;feed=atom&amp;title=AC%2FBounce</id>
	<title>AC/Bounce - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.tiffa.net/w/index.php?action=history&amp;feed=atom&amp;title=AC%2FBounce"/>
	<link rel="alternate" type="text/html" href="https://wiki.tiffa.net/w/index.php?title=AC/Bounce&amp;action=history"/>
	<updated>2026-04-17T01:37:45Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://wiki.tiffa.net/w/index.php?title=AC/Bounce&amp;diff=2254&amp;oldid=prev</id>
		<title>imported&gt;Fire at 13:21, 24 November 2022</title>
		<link rel="alternate" type="text/html" href="https://wiki.tiffa.net/w/index.php?title=AC/Bounce&amp;diff=2254&amp;oldid=prev"/>
		<updated>2022-11-24T13:21:14Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;起動時のスプラッシュ画面が欲しくて追加してみた。&lt;br /&gt;
&lt;br /&gt;
下記、コードのBounceが、コードが複雑にならず簡単に使えそうなので流用させてもらった。&lt;br /&gt;
&lt;br /&gt;
[https://github.com/chitomo12/SwiftUI-Text-Animation-Library SwiftUI Text Animation Library] &lt;br /&gt;
&lt;br /&gt;
== 説明 ==&lt;br /&gt;
スプラッシュ画面で、アニメーションさせた後に、ホーム画面のViewを起動する。&lt;br /&gt;
&lt;br /&gt;
;L.2&lt;br /&gt;
:[[SwiftUI/PropertyWrapper/@State|@State]]を使用し、アニメーションの終了判定のためのフラグを監視させる。&lt;br /&gt;
&lt;br /&gt;
;L.4&lt;br /&gt;
:isLoading でアニメーション表示判定。&lt;br /&gt;
&lt;br /&gt;
;L.5~8&lt;br /&gt;
:背景色を設定するため[[SwiftUI/Layout fundamentals/ZStack|ZStack]]で、背景をZ軸方向に重ね合わせ。背景は、[[SwiftUI/Drawing and graphics/Color|Color]] で色指定を行う。&lt;br /&gt;
&lt;br /&gt;
;L.10~21&lt;br /&gt;
:[[SwiftUI/Layout fundamentals/VStack|VStack]]を使用し、ロゴの下にBounce View のアニメーションを配置。0.5秒ずつずらして、３つアニメーションを動かす。.padding使って上方向に30px余白追加。&lt;br /&gt;
&lt;br /&gt;
;L.23~27&lt;br /&gt;
:もっとスマートな方法がある気がするが、アニメーションを指定秒表示させるため、View表示開始時に .onAppearで、非同期タスク起動させ 指定秒遅らせて、その後isLoadingをtoggleさせることで、アニメーション表示を抜けるようにした。&lt;br /&gt;
&lt;br /&gt;
;L.29~33&lt;br /&gt;
:アニメーション処理終了後にホーム画面を呼び出す。EnrionmentObjectでデータ共有するためにUserData()オブジェクトをを初期化して、EnvrironmentObjectでContentViewに渡す。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Swift&amp;quot; line&amp;gt;&lt;br /&gt;
struct Bounce: View {&lt;br /&gt;
    @State private var isLoading = true&lt;br /&gt;
    var body: some View {&lt;br /&gt;
        if isLoading {&lt;br /&gt;
            ZStack {&lt;br /&gt;
                Color.white&lt;br /&gt;
                    .opacity(0.9)&lt;br /&gt;
                    .ignoresSafeArea()&lt;br /&gt;
                &lt;br /&gt;
                VStack {&lt;br /&gt;
                    Image(&amp;quot;LaunchScreen&amp;quot;)&lt;br /&gt;
                        .resizable()&lt;br /&gt;
                        .aspectRatio(contentMode: .fit)&lt;br /&gt;
                        .padding()&lt;br /&gt;
                    &lt;br /&gt;
                    BounceAnimationView(text: &amp;quot;仮想通貨&amp;quot;, startTime: 0.0, color: Color.black)&lt;br /&gt;
                    BounceAnimationView(text: &amp;quot;貴金属&amp;quot;, startTime: 0.5, color: Color.black)&lt;br /&gt;
                        .padding(.top, 30)&lt;br /&gt;
                    BounceAnimationView(text: &amp;quot;外貨資産&amp;quot;, startTime: 1.0, color: Color.black)&lt;br /&gt;
                        .padding(.top, 30)&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
            .onAppear {&lt;br /&gt;
                DispatchQueue.main.asyncAfter(deadline: .now() + 2.2) {&lt;br /&gt;
                        isLoading = false&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
        } else {&lt;br /&gt;
            ContentView()&lt;br /&gt;
                .environmentObject(UserData())&lt;br /&gt;
                &lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:AssetCollector|Bounce]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Fire</name></author>
	</entry>
</feed>