}
// Event timeline.
JsonValue eventsMap = map.get("events");
if (eventsMap != null) {
EventTimeline timeline = new EventTimeline(eventsMap.size);
int frameIndex = 0;
for (JsonValue eventMap = eventsMap.child; eventMap != null; eventMap = eventMap.next) {
EventData eventData = skeletonData.findEvent(eventMap.getString("name"));
if (eventData == null) throw new SerializationException("Event not found: " + eventMap.getString("name"));
Event event = new Event(eventData);
event.intValue = eventMap.getInt("int", eventData.getInt());
event.floatValue = eventMap.getFloat("float", eventData.getFloat());
event.stringValue = eventMap.getString("string", eventData.getString());
timeline.setFrame(frameIndex++, eventMap.getFloat("time"), event);
}
timelines.add(timeline);
duration = Math.max(duration, timeline.getFrames()[timeline.getFrameCount() - 1]);
}
timelines.shrink();
skeletonData.animations.add(new Animation(name, timelines, duration));
}