public AnimClip buildAnimation(HasLocalTransform target) {
        Set<Float> times = new TreeSet<>();
        for (int frameI = 0;; ++frameI) {
            float time = frameI / fps;
            if (time > duration) {
                break;
            }
            times.add(time);
        }
        times.addAll(rotations.keySet());
        times.addAll(scales.keySet());
        times.addAll(translations.keySet());

        int numFrames = times.size();
        float[] timeArray = new float[numFrames];
        Vector3f[] translateArray = new Vector3f[numFrames];
        Quaternion[] rotArray = new Quaternion[numFrames];
        Vector3f[] scaleArray = new Vector3f[numFrames];

        int iFrame = 0;
        for (float time : times) {
            timeArray[iFrame] = time;
            translateArray[iFrame] = interpolateTranslation(time);
            rotArray[iFrame] = interpolateRotation(time);
            scaleArray[iFrame] = interpolateScale(time);

            ++iFrame;
        }

        AnimTrack[] tracks = new AnimTrack[1];
        tracks[0] = new TransformTrack(target, timeArray, translateArray,
                rotArray, scaleArray);
        AnimClip result = new AnimClip(name);
        result.setTracks(tracks);

        return result;
    }
Create an AnimClip based on the keyframes added to this factory.

@param target the target for this clip (which is typically a Spatial)
@return a new clip
jme3-core/src/main/java/com/jme3/anim/AnimFactory.java