-- Stage 4 test: node animation. BoxAnimated's lid rotates and the inner box rises; two -- instances at different speeds, a third paused at a fixed time. local font = fontLoad("Singe/FreeSansBold.ttf", 28) local frames = 0 fontSelect(font) discPlay() sceneEnable(true) sceneSetBackground(0, 0, 0, 0) sceneSetAmbient(60, 60, 70) local boxModel = modelLoad("testScripts/Models/BoxAnimated.glb") local names = modelGetAnimations(boxModel) debugPrint("animations " .. #names .. " first '" .. tostring(names[1]) .. "'") local a = modelInstance(boxModel) nodeSetPosition(a, -2.2, -1, 0) nodeSetScale(a, 0.5) animationPlay(a, 1, true) local b = modelInstance(boxModel) nodeSetPosition(b, 0.2, -1, 0) nodeSetScale(b, 0.5) animationPlay(b, 1, true, 3.0) local c = modelInstance(boxModel) nodeSetPosition(c, 2.6, -1, 0) nodeSetScale(c, 0.5) animationPlay(c, 1, false) animationSetTime(c, 1.5) animationPause(c) local sun = lightNew(LIGHT_DIRECTIONAL) nodeSetPosition(sun, 2, 4, 3) nodeLookAt(sun, 0, 0, 0) lightSetIntensity(sun, 1.5) local camera = nodeNew() nodeSetPosition(camera, 0, 1.5, 6) nodeLookAt(camera, 0, 0, 0) cameraSet(camera) function onOverlayUpdate() frames = frames + 1 overlayClear() fontPrint(20, 20, string.format("Stage 4, frame %d a=%.2f b=%.2f c=%.2f playing=%s", frames, animationGetTime(a), animationGetTime(b), animationGetTime(c), tostring(animationIsPlaying(c)))) if frames == 30 or frames == 75 then singeScreenshot() end if frames == 90 then singeQuit() end end