Open InfiniteFalltrough opened 4 months ago
Hi @InfiniteFalltrough, thanks for reporting and sorry that you're running into this. Could you share a sample project with us that shows how you're using the SDK with the animations you're using that are showing these metrics?
Hi @InfiniteFalltrough, thanks for reporting and sorry that you're running into this. Could you share a sample project with us that shows how you're using the SDK with the animations you're using that are showing these metrics?
sorry for the late response... metrics:
https://github.com/rive-app/rive-ios/assets/65627244/e1a50c1c-8f44-4387-89f4-c2df59491641
code:
struct ContentView: View {
@State private var model = RiveViewModel(fileName: "sample/scrub-blend.2dc5d861e4cae3df534b", stateMachineName: "State Machine 1", fit: .fitWidth, alignment: .center, artboardName: "Blend") @State private var scrollPercentage: CGFloat = 0 var body: some View { PositionReadableScrollView(content: { VStack { model.view().frame(width: width, height: height) Rectangle().frame(height: 200).foregroundColor(.clear) Spacer() }.frame(height: height + 200) }, onScroll: { value in let scroll = (value * -1) / 4 model.setInput("ScrollPercentage", value: scroll) }) }
}
struct PositionReadableScrollView
: View where Content: View { let axes: Axis.Set = .vertical let content: () -> Content let onScroll: (CGFloat) -> Void var body: some View { ScrollView(axes) { content() .background( GeometryReader { proxy in let position = ( axes == .vertical ? proxy.frame(in: .named("scrollID")).origin.y : proxy.frame(in: .named("scrollID")).origin.x ) Color.clear .onChange(of: position) { position, _ in onScroll(position) } } ) } .coordinateSpace(.named("scrollID")) }
}
I can even share our .riv for test, but privately, not here (if needed).
Hope something can be done about it.... I'll be grateful for any response!
do you think it's because of the onscroll calling rive more frequently? (i'm looking to do something similar)
onScroll: { value in
let scroll = (value * -1) / 4
model.setInput("ScrollPercentage", value: scroll)
})
do you think it's because of the onscroll calling rive more frequently? (i'm looking to do something similar)
onScroll: { value in let scroll = (value * -1) / 4 model.setInput("ScrollPercentage", value: scroll) })
no clue, really, the documentation for the iOS part doesn't say anything useful. (there is an opinion that the entire animation is redrawn completely, and not just rewound - just guesswork)
we have a huge animation (comics) and so far we have settled on Lottie since the metrics are much better than Rive in all respects... but I hope that Rive will be able to solve this problem, since this is a new and very convenient solution for production and I would like to work with it!
perhaps someone has already encountered the following behavior:
does anyone know possible ways to optimize (at least energy consumption)?
(update: Skia/Rive - doesn't matter)