Package com.esotericsoftware.spine.Animation

Examples of com.esotericsoftware.spine.Animation.EventTimeline


    for (int i = 0; i < eventCount; i++)
      buffer.append((char)('a' + i));

    this.events = buffer.toString().toCharArray();
    this.frames = frames;
    timeline = new EventTimeline(eventCount);

    float maxFrame = 0;
    int distinctCount = 0;
    float lastFrame = -1;
    for (int i = 0; i < eventCount; i++) {
View Full Code Here


      }

      // Event timeline.
      int eventCount = input.readInt(true);
      if (eventCount > 0) {
        EventTimeline timeline = new EventTimeline(eventCount);
        for (int i = 0; i < eventCount; i++) {
          float time = input.readFloat();
          EventData eventData = skeletonData.events.get(input.readInt(true));
          Event event = new Event(eventData);
          event.intValue = input.readInt(false);
          event.floatValue = input.readFloat();
          event.stringValue = input.readBoolean() ? input.readString() : eventData.stringValue;
          timeline.setFrame(i, time, event);
        }
        timelines.add(timeline);
        duration = Math.max(duration, timeline.getFrames()[eventCount - 1]);
      }
    } catch (IOException ex) {
      throw new SerializationException("Error reading skeleton file.", ex);
    }
View Full Code Here

    }

    // 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));
  }
View Full Code Here

TOP

Related Classes of com.esotericsoftware.spine.Animation.EventTimeline

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.