GithubHelp home page GithubHelp logo

timeline's Introduction

timeline

timeline component with tags for video players

Requirements

  • jQuery
  • jQueryUI (only Draggable and Resizable components)

Usage

Full example you can find in example/simple/index.html

Init timeline

var timeline = new Timeline('#timeline', options);

Timeline class

Options

  • width - Width of timeline
  • duration - Length of video in seconds
  • framesNumber - Number of frames
  • framesOrder - Array of frames classes names
  • align - Boolean, should tags align to top or not
  • tags - Array of TimelineTag class options

Methods

  • getRootNode() - Return root element
  • goToNextSecond() - Move pointer on one second forvard
  • goToPrevSecond() - Move pointer on one second backvard
  • goTo(seconds) - Move pointer to exac position on timeline
  • addTag(options) - Add tag to timeline
  • getTags() - Return array of objects of TimelineTag class
  • setFramesNumber(int) - set number of frames
  • formatTime(int) - function which converts seconds to format "mm:ss", you can overwrite this function to change frames time format
  • toJSON() - returns copy of timeline object cleared from internal fields

All methods except getters will returns timeline itself.

Properties

  • pointer - jQuery object of current second pointer
  • currentSecond - number of current position of pointer in seconds

TimelineTag class

Options

  • title - Title of tag
  • start - Start time in seconds. Default to 0
  • length - Length in seconds
  • line - Number of line
  • draggable - Boolean, default to true, shows can tag to be draggable and resizable or not
  • events - Hash of events names and their callbacks

Methods

  • setTitle(string) - set title of tag
  • setStart(int) - set start of tag in seconds
  • setLength(int) - set length of tag in seconds
  • setLine(int) - set tag on line in timeline
  • getFreeLine() - get free line for this tag on timeline
  • on(event, callback) - bind callback to event of tag
  • trigger(event, arguments) - trigger event of tag with optional arguments in array
  • remove() - remove tag from timeline

Properties

  • rootNode - jQuery object of tag
  • title - Title of tag
  • start - Start time in seconds. Default to 0
  • length - Length in seconds
  • line - Number of line

Events

Scope (this keyword) in callback will be tag itself. First parameter of all callback will be event object

  • setTitle
  • setStart
  • setLength
  • setLine
  • remove

Templating

Base html is

<div>
    <ul class="frames">
        <li class="pointer"></li>
        <li class="frame">
            <div class="time"></div>
        </li>
    </ul>
    <ul class="tags-lines">
        <li>
            <div class="tag">
                <span class="title"></span>
            </div>
        </li>
    </ul>
</div>

And you can customize it as you want. For example I added to "pointer" and "frame" div with class "line", to show vertical line. You can add to "pointer" some element for arrow. Or you can add to "tag" some image.

timeline's People

Contributors

redexp avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.