import eu.moonlight3d # fetch main document state = eu.moonlight3d.framework.State.getInstance() document = state.getDocumentManager().getMainDocument() # create a sphere ogManager=document.getOGManager(); createSphere=ogManager.createNodeByName("CreateSphere") createSphere.getProperty("divisionsU").setValue(64) createSphere.getProperty("divisionsV").setValue(64) ogManager.update() # add an animation animation = document.getAnimationManager().createAnimation("Animation") animation.setStartTime(0.0) animation.setEndTime(5.0) animation.setFramesPerSecond(24) # add an animation track track = eu.moonlight3d.ml3d.backend.threedim.anim.KeyframeAnimationTrack() track.setNodeName("CreateSphere") track.setPropertyName("radius") animation.addTrack(track) # set extrapolators startExtrapolator=eu.moonlight3d.ml3d.backend.threedim.anim.LinearValueInterpolator() track.setStartExtrapolator(startExtrapolator) endExtrapolator=eu.moonlight3d.ml3d.backend.threedim.anim.LinearValueInterpolator() track.setEndExtrapolator(endExtrapolator) # Add key frames to the track startInterpolator=eu.moonlight3d.ml3d.backend.threedim.anim.LinearValueInterpolator() startValue=eu.moonlight3d.framework.helper.Value() startValue.setType(eu.moonlight3d.framework.helper.Value.Type.Float) startValue.setValue(0.5) track.insertKey(0.0,startValue,startInterpolator) endInterpolator=eu.moonlight3d.ml3d.backend.threedim.anim.LinearValueInterpolator() endValue=eu.moonlight3d.framework.helper.Value() endValue.setType(eu.moonlight3d.framework.helper.Value.Type.Float) endValue.setValue(2.0) track.insertKey(5.0,endValue,endInterpolator) # Go to the middle of the animation animation.setToTime(2.5); ogManager.update() # Restore default value #animation.resetDefaults() #ogManager.update()