abstract class AnimatedButton : Button() { @Attribute var showInSeconds = 1.0 @Attribute var duration = 1.0 override fun activated() { super.activated() if (duration != 0) { // Hide it. Move it below the bottom of the screen. actor.y -= actor.stage.firstView().worldHeight actor.scaleXY = 0.1 } } override fun createAction() : Action { return if ( duration == 0 ) { null } else { val animation = MoveBy( actor.position, duration, Vector2(0, actor.stage.firstView().worldHeight), Eases.easeOut ) and ScaleTo( actor, duration, 1 ) Delay( showInSeconds ) then( animation ) then EventAction(actor,"ding") } } } class ChapterButton : AnimatedButton() { @Attribute var chapter = 1 override fun onClicked(event: MouseEvent) { HiggsAnomaly.instance.chapter = chapter startScene("chapter$chapter/1") } } class AnimatedSceneButton : AnimatedButton() { @Attribute( isSceneName=true ) var scene = "" override fun onClicked( event : MouseEvent ) { startScene( scene ) } }