Advertisement
jossstuart

Untitled

Nov 18th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 1.22 KB | None | 0 0
  1. private fun buildAnimation(qiContext: QiContext?) {
  2.         val animation = AnimationBuilder.with(qiContext) // Create the builder with the context.
  3.             .withResources(R.raw.dance) // Set the animation resource.
  4.             .build() // Build the animation.
  5.  
  6.         val animateAction = AnimateBuilder.with(qiContext) // Create the builder with the context.
  7.             .withAnimation(animation) // Set the animation.
  8.             .build() // Build the animate action.
  9.  
  10.         animateAction.addOnLabelReachedListener { label, time ->
  11.             Log.d(TAG, "label reached : $label")
  12.  
  13.             val splitLabels = label.split(":").toTypedArray()
  14.             when (splitLabels[0]) {
  15.                 "trajectory" -> startPmt()
  16.                 else -> {
  17.                     Log.d(TAG, "Unknown type of element : ${splitLabels[0]}")
  18.                 }
  19.             }
  20.         }
  21.    
  22.         animateAction.async().run()
  23.     }
  24.  
  25. private fun startPmt() {
  26.         val animation = AnimationBuilder.with(qiContext)
  27.             .withResources(R.raw.trajectory)
  28.             .build()
  29.  
  30.         val pmtAnimate = AnimateBuilder.with(qiContext)
  31.             .withAnimation(animation)
  32.             .build()
  33.  
  34.         pmtAnimate.async().run()
  35.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement