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

Add more animation methods #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@ package com.willfp.modelenginebridge
interface BridgedAnimationHandler {
val model: BridgedActiveModel

fun getAnimation(name: String): BridgedAnimation?
fun playAnimation(animation: String, lerpIn: Double, lerpOut: Double, speed: Double, force: Boolean): Boolean

fun playAnimation(animation: BridgedAnimation, force: Boolean)
fun playAnimation(animation: BridgedAnimation, force: Boolean): Boolean

fun isPlayingAnimation(animation: String): Boolean

fun stopAnimation(animation: String)

fun forceStopAnimation(animation: String)

fun forceStopAllAnimations()

fun getAnimation(animation: String): BridgedAnimation?
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,40 @@ class AnimationHandlerImpl(
val handle: AnimationHandler,
override val model: BridgedActiveModel
): BridgedAnimationHandler {
override fun getAnimation(name: String): BridgedAnimation? {
val animation = handle.getAnimation(name) ?: return null
return AnimationImpl(animation)
override fun playAnimation(
animation: String,
lerpIn: Double,
lerpOut: Double,
speed: Double,
force: Boolean
): Boolean {
return handle.playAnimation(animation, lerpIn, lerpOut, speed, force)
}

override fun playAnimation(animation: BridgedAnimation, force: Boolean) {
override fun playAnimation(animation: BridgedAnimation, force: Boolean): Boolean {
animation as AnimationImpl

handle.playAnimation(animation.handle, force)
return handle.playAnimation(animation.handle, force)
}

override fun isPlayingAnimation(animation: String): Boolean {
return handle.isPlayingAnimation(animation)
}

override fun stopAnimation(animation: String) {
handle.stopAnimation(animation)
}

override fun forceStopAnimation(animation: String) {
handle.forceStopAnimation(animation)
}

override fun forceStopAllAnimations() {
handle.forceStopAllAnimations()
}

override fun getAnimation(name: String): BridgedAnimation? {
val animation = handle.getAnimation(name) ?: return null
return AnimationImpl(animation)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,39 @@ class AnimationHandlerImpl(
val handle: AnimationHandler,
override val model: BridgedActiveModel
): BridgedAnimationHandler {
override fun getAnimation(name: String): BridgedAnimation? {
val animation = handle.getAnimation(name) ?: return null
return AnimationImpl(animation)
override fun playAnimation(
animation: String,
lerpIn: Double,
lerpOut: Double,
speed: Double,
force: Boolean
): Boolean {
return handle.playAnimation(animation, lerpIn, lerpOut, speed, force) != null
}

override fun playAnimation(animation: BridgedAnimation, force: Boolean) {
override fun playAnimation(animation: BridgedAnimation, force: Boolean): Boolean {
animation as AnimationImpl

handle.playAnimation(animation.handle, force)

return handle.playAnimation(animation.handle, force)
}

override fun isPlayingAnimation(animation: String): Boolean {
return handle.isPlayingAnimation(animation)
}

override fun stopAnimation(animation: String) {
return handle.stopAnimation(animation)
}

override fun forceStopAnimation(animation: String) {
handle.forceStopAnimation(animation)
}
override fun forceStopAllAnimations() {
handle.forceStopAllAnimations()
}

override fun getAnimation(name: String): BridgedAnimation? {
val animation = handle.getAnimation(name) ?: return null
return AnimationImpl(animation)
}
}