Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is it possible for two animations from different files to exist? #324

Open
IzabourAzevedo opened this issue May 27, 2024 · 1 comment
Open

Comments

@IzabourAzevedo
Copy link

is it possible for two animations from different files to exist? and they work separately but as soon as i say i need one to be enabled only in long press it doesn't work.

RiveRuntime/RiveViewModel.swift:213: Fatal error: 'try!' expression unexpectedly raised an error: RiveRuntime.RiveModel.RiveModelError.invalidAnimation("Name hana not found")

VStack {
if isLongPressed {
secondaryRiveViewModel.view()
.frame(width: 360, height: 136)
.onAppear {
secondaryRiveViewModel.play(animationName: "hanasad")
}
} else {
riveViewModel.view()
.frame(width: 360, height: 136)
.onAppear {
setupRive()
}
}
}
.gesture(
LongPressGesture(minimumDuration: 1.0)
.onChanged { _ in
handleLongPress()
}
.onEnded { _ in
isLongPressed = false
}
)
}

@dskuza
Copy link
Collaborator

dskuza commented Sep 4, 2024

@IzabourAzevedo It should be possible, so long as you have separate view models, which it looks like you do. Are you still experiencing this issue? It looks like you might be using an animation name that doesn't match that in your exported .riv file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants