-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecated old RiveFile utils. Converted Layout, BlendModes and State…
…Machine UIKit examples. Commented out unused examples and old RiveView related things. Fixed SimpleAnimation presentation issues.
- Loading branch information
1 parent
e6039be
commit a456f48
Showing
17 changed files
with
2,311 additions
and
2,276 deletions.
There are no files selected for viewing
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
328 changes: 164 additions & 164 deletions
328
Example-iOS/Source/SwiftUI/Explorer/RiveExplorer.swift
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,166 +1,166 @@ | ||
import SwiftUI | ||
import RiveRuntime | ||
|
||
struct RiveExplorer: DismissableView { | ||
@ObservedObject private var riveController = RiveExplorerController( | ||
"artboard_animations", | ||
fit: Fit.fitCover | ||
) | ||
@State private var loopCount: Int = 0 | ||
@State private var selection = 1 | ||
|
||
var dismiss: () -> Void = {} | ||
|
||
var body: some View { | ||
ZStack(alignment: .bottomLeading) { | ||
RiveExplorerBridge( | ||
controller: riveController | ||
) | ||
VStack { | ||
HStack(alignment: .center, spacing: 50) { | ||
Menu { | ||
ForEach(riveController.artboardNames(), id: \.self) { name in | ||
Button { | ||
riveController.activeArtboard = name | ||
} label: { | ||
Text(name) | ||
} | ||
} | ||
} label: { | ||
Text("Artboards") | ||
Image(systemName: "square.and.pencil") | ||
} | ||
Menu { | ||
ForEach(riveController.animationNames(), id: \.self) { name in | ||
Button { | ||
riveController.playAnimation = name | ||
} label: { | ||
Text(name) | ||
} | ||
} | ||
} label: { | ||
Text("Animations") | ||
Image(systemName: "list.and.film") | ||
} | ||
} | ||
.padding() | ||
HStack(alignment: .center, spacing: 50) { | ||
Menu { | ||
Button { | ||
riveController.fit = .fitContain | ||
} label: { | ||
Text("Contain") | ||
} | ||
Button { | ||
riveController.fit = .fitCover | ||
} label: { | ||
Text("Cover") | ||
} | ||
Button { | ||
riveController.fit = .fitFill | ||
} label: { | ||
Text("Fill") | ||
} | ||
} label: { | ||
Text("Fit") | ||
Image(systemName: "crop") | ||
} | ||
Menu { | ||
Button { | ||
riveController.alignment = .alignmentTopLeft | ||
} label: { | ||
Text("Top Left") | ||
} | ||
Button { | ||
riveController.alignment = .alignmentTopCenter | ||
} label: { | ||
Text("Top Center") | ||
} | ||
Button { | ||
riveController.alignment = .alignmentTopRight | ||
} label: { | ||
Text("Top Right") | ||
} | ||
Button { | ||
riveController.alignment = .alignmentCenterLeft | ||
} label: { | ||
Text("Left") | ||
} | ||
Button { | ||
riveController.alignment = .alignmentCenter | ||
} label: { | ||
Text("Center") | ||
} | ||
Button { | ||
riveController.alignment = .alignmentCenterRight | ||
} label: { | ||
Text("Right") | ||
} | ||
Button { | ||
riveController.alignment = .alignmentBottomLeft | ||
} label: { | ||
Text("Bottom Left") | ||
} | ||
Button { | ||
riveController.alignment = .alignmentBottomCenter | ||
} label: { | ||
Text("Bottom Center") | ||
} | ||
Button { | ||
riveController.alignment = .alignmentBottomRight | ||
} label: { | ||
Text("Bottom Right") | ||
} | ||
} label: { | ||
Text("Alignment") | ||
Image(systemName: "square.dashed") | ||
} | ||
} | ||
.padding() | ||
HStack { | ||
Button { | ||
if riveController.playback == Playback.play { | ||
riveController.pause() | ||
} else { | ||
riveController.play() | ||
} | ||
} label: { | ||
switch riveController.playback { | ||
case .play: | ||
Image(systemName: "pause.circle") | ||
Text("Pause") | ||
case .pause, .stop: | ||
Image(systemName: "play.circle") | ||
Text("Play") | ||
@unknown default: | ||
fatalError("Unknown playback value") | ||
} | ||
|
||
|
||
} | ||
Spacer() | ||
Button { | ||
|
||
dismiss() | ||
} label: { | ||
Image(systemName: "x.circle") | ||
Text("Dismiss") | ||
} | ||
|
||
// Button(action: dismiss, label: { | ||
//import SwiftUI | ||
//import RiveRuntime | ||
// | ||
//struct RiveExplorer: DismissableView { | ||
// @ObservedObject private var riveController = RiveExplorerController( | ||
// "artboard_animations", | ||
// fit: Fit.fitCover | ||
// ) | ||
// @State private var loopCount: Int = 0 | ||
// @State private var selection = 1 | ||
// | ||
// var dismiss: () -> Void = {} | ||
// | ||
// var body: some View { | ||
// ZStack(alignment: .bottomLeading) { | ||
// RiveExplorerBridge( | ||
// controller: riveController | ||
// ) | ||
// VStack { | ||
// HStack(alignment: .center, spacing: 50) { | ||
// Menu { | ||
// ForEach(riveController.artboardNames(), id: \.self) { name in | ||
// Button { | ||
// riveController.activeArtboard = name | ||
// } label: { | ||
// Text(name) | ||
// } | ||
// } | ||
// } label: { | ||
// Text("Artboards") | ||
// Image(systemName: "square.and.pencil") | ||
// } | ||
// Menu { | ||
// ForEach(riveController.animationNames(), id: \.self) { name in | ||
// Button { | ||
// riveController.playAnimation = name | ||
// } label: { | ||
// Text(name) | ||
// } | ||
// } | ||
// } label: { | ||
// Text("Animations") | ||
// Image(systemName: "list.and.film") | ||
// } | ||
// } | ||
// .padding() | ||
// HStack(alignment: .center, spacing: 50) { | ||
// Menu { | ||
// Button { | ||
// riveController.fit = .fitContain | ||
// } label: { | ||
// Text("Contain") | ||
// } | ||
// Button { | ||
// riveController.fit = .fitCover | ||
// } label: { | ||
// Text("Cover") | ||
// } | ||
// Button { | ||
// riveController.fit = .fitFill | ||
// } label: { | ||
// Text("Fill") | ||
// } | ||
// } label: { | ||
// Text("Fit") | ||
// Image(systemName: "crop") | ||
// } | ||
// Menu { | ||
// Button { | ||
// riveController.alignment = .alignmentTopLeft | ||
// } label: { | ||
// Text("Top Left") | ||
// } | ||
// Button { | ||
// riveController.alignment = .alignmentTopCenter | ||
// } label: { | ||
// Text("Top Center") | ||
// } | ||
// Button { | ||
// riveController.alignment = .alignmentTopRight | ||
// } label: { | ||
// Text("Top Right") | ||
// } | ||
// Button { | ||
// riveController.alignment = .alignmentCenterLeft | ||
// } label: { | ||
// Text("Left") | ||
// } | ||
// Button { | ||
// riveController.alignment = .alignmentCenter | ||
// } label: { | ||
// Text("Center") | ||
// } | ||
// Button { | ||
// riveController.alignment = .alignmentCenterRight | ||
// } label: { | ||
// Text("Right") | ||
// } | ||
// Button { | ||
// riveController.alignment = .alignmentBottomLeft | ||
// } label: { | ||
// Text("Bottom Left") | ||
// } | ||
// Button { | ||
// riveController.alignment = .alignmentBottomCenter | ||
// } label: { | ||
// Text("Bottom Center") | ||
// } | ||
// Button { | ||
// riveController.alignment = .alignmentBottomRight | ||
// } label: { | ||
// Text("Bottom Right") | ||
// } | ||
// } label: { | ||
// Text("Alignment") | ||
// Image(systemName: "square.dashed") | ||
// } | ||
// } | ||
// .padding() | ||
// HStack { | ||
// Button { | ||
// if riveController.playback == Playback.play { | ||
// riveController.pause() | ||
// } else { | ||
// riveController.play() | ||
// } | ||
// } label: { | ||
// switch riveController.playback { | ||
// case .play: | ||
// Image(systemName: "pause.circle") | ||
// Text("Pause") | ||
// case .pause, .stop: | ||
// Image(systemName: "play.circle") | ||
// Text("Play") | ||
// @unknown default: | ||
// fatalError("Unknown playback value") | ||
// } | ||
// | ||
// | ||
// } | ||
// Spacer() | ||
// Button { | ||
// | ||
// dismiss() | ||
// } label: { | ||
// Image(systemName: "x.circle") | ||
// Text("Dismiss") | ||
// }) | ||
} | ||
.padding() | ||
} | ||
.background(Color.init(white: 0, opacity: 0.75)) | ||
} | ||
} | ||
} | ||
|
||
struct RiveSwiftUIView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
RiveExplorer() | ||
} | ||
} | ||
// } | ||
// | ||
//// Button(action: dismiss, label: { | ||
//// Image(systemName: "x.circle") | ||
//// Text("Dismiss") | ||
//// }) | ||
// } | ||
// .padding() | ||
// } | ||
// .background(Color.init(white: 0, opacity: 0.75)) | ||
// } | ||
// } | ||
//} | ||
// | ||
//struct RiveSwiftUIView_Previews: PreviewProvider { | ||
// static var previews: some View { | ||
// RiveExplorer() | ||
// } | ||
//} |
Oops, something went wrong.