enum class EllipticalType { CIRCLE, ELLIPSE, ELLIPSE_START_90, ELLIPSE_START_180, ELLIPSE_TILT_45, ELLIPSE_REVERSE, ROUNDED_RECT } class EllipticalRole : ActionRole { @Attribute var type = EllipticalType.CIRCLE override fun createAction() : Action { return if ( type == EllipticalType.CIRCLE ) { Circular( actor.position, 10, 100 ).forever() } else if ( type == EllipticalType.ELLIPSE ) { Elliptical( actor.position, 15, Vector2( 70, 100 ) ).forever() } else if ( type == EllipticalType.ELLIPSE_REVERSE ) { Elliptical( actor.position, 15, Vector2( 70, 100 ) ).reverse().forever() } else if ( type == EllipticalType.ELLIPSE_START_90 ) { Elliptical( actor.position, 15, Vector2( 70, 100 ) ).start( Angle.degrees(90) ).forever() } else if ( type == EllipticalType.ELLIPSE_START_180 ) { Elliptical( actor.position, 15, Vector2( 70, 100 ) ).start( Angle.degrees(180) ).forever() } else if ( type == EllipticalType.ELLIPSE_TILT_45 ) { Elliptical( actor.position, 15, Vector2( 70, 100 ) ).tilt( Angle.degrees(45) ).forever() } else if ( type == EllipticalType.ROUNDED_RECT ) { val lengthSeconds = 1 val cornerSeconds = 0.3 val length = 100 val radius = 20 ( MoveXBy( actor.position, lengthSeconds, length ) then CircularArcBy( actor.position, cornerSeconds, Vector2(radius,radius), radius, false, true ) then MoveYBy( actor.position, lengthSeconds, length ) then CircularArcBy( actor.position, cornerSeconds, Vector2(-radius,radius), radius, false, true ) then MoveXBy( actor.position, lengthSeconds, -length ) then CircularArcBy( actor.position, cornerSeconds, Vector2(-radius,-radius), radius, false, true ) then MoveYBy( actor.position, lengthSeconds, -length ) then CircularArcBy( actor.position, cornerSeconds, Vector2(radius,-radius), radius, false, true ) ).forever() } else { Delay(1) } } }