In this example a text within a shape is animated.
/* Retrieve the Desktop object, we need its XComponentLoader interface to load a new document */
oDesktop = UNO.createDesktop() -- get the UNO Desktop service object
xComponentLoader = oDesktop~{%see com.sun.star.frame.XDesktop%XDesktop}~{%see com.sun.star.frame.XComponentLoader%XComponentLoader} -- get componentLoader interface
/* open the blank file */
url = "private:factory/sdraw"
xDrawComponent = xComponentLoader~loadComponentFromURL(url, "_blank", 0, -
.UNO~noProps)
/* need document's factory to be able to insert created objects */
xDocumentFactory = xDrawComponent~{%see com.sun.star.lang.XMultiServiceFactory%XMultiServiceFactory}
/* get draw page by index */
xDrawPage = xDrawComponent~{%see com.sun.star.drawing.XDrawPagesSupplier%XDrawPagesSupplier}~getDrawPages~getByIndex(0)~{%see com.sun.star.drawing.XDrawPage%XDrawPage}
/* create a Rectangle and add it to the shape */
xcircle = xDocumentFactory~createInstance("{%see com.sun.star.drawing.EllipseShape}")~{%see com.sun.star.drawing.XShape%xshape}
xcircle~setPosition(.bsf~new("{%see com.sun.star.awt.Point}", 1000, 1000))
xcircle~setSize(.bsf~new("{%see com.sun.star.awt.Size}", 10000, 5000))
xDrawPage~add(xcircle)
/* set the properties of the rectangle shape */
xShapeProps = xcircle~{%see com.sun.star.beans.XPropertySet%XPropertySet}
xShapeProps~setPropertyValue("FillColor", box("int", "EE9A00"x ~c2d)) -- set fill colour orange
/* set the properties of the circle */
xShapeProps~setPropertyValue("TextAnimationKind", -
bsf.getConstant("{%see com.sun.star.drawing.TextAnimationKind}", "BLINK"))
xText = xcircle~{%see com.sun.star.text.XText%XText}
xTextCursor = xText~createTextCursor
xTextCursor~gotoEnd(.false)
xTextRange = xTextCursor~{%see com.sun.star.text.XTextRange%XTextRange}
xTextRange~setString("I am animated!")
call syssleep 3
xShapeProps~setPropertyValue("TextAnimationKind", -
bsf.getConstant("com.sun.star.drawing.TextAnimationKind", "ALTERNATE"))
::requires UNO.cls -- get UNO support