• Stars
    star
    541
  • Rank 82,114 (Top 2 %)
  • Language
    JavaScript
  • Created over 13 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A compact JavaScript animation library with a GUI timeline for fast editing.

Timeline.js

A compact JavaScript animation library with a GUI timeline for fast editing.

Check it out in this example: http://vorg.github.io/timeline.js/examples/cssAnimation.html

More on the project website: http://marcinignac.com/blog/timeline-js/

Created by Marcin Ignac

Timeline

Usage:

1. Animation

<script type="text/javascript" src="timeline/timeline.js"></script>

anim(target).to(delay, {property:value,...}, duration, easing);

After specifying the target using anim() you can chain as many to() animations as you want. To start parallel track simply call anim() on the same target again.

1.1 Basic example

Animate x property of the sprite object to 100 over 1s using quadratic easing. Then wait 5s and animate it back to 0 over 2s

anim(sprite).to({x:100}, 1, Timeline.Easing.Quadratic.EaseIn).to(5, {x:0}, 2);

1.2 Example of parallel animations

Animate width and height of the rect object to 50 and 75 over 3s. At the same time animate opacity to 0 over 4s.

anim(rect).to({width:50, height:75}, 3);
anim(rect).to({opacity:0}, 4);

2. Timeline GUI

<script type="text/javascript" src="timeline/gui.js"></script>

anim(targetName, target).to(delay, {property:value,...}, duration, easing);

Adding gui.js script to the page will open a timeline panel on the bottom of the page if any animation was added before first frame. One track for every animated property will be created. Click and drag to edit key frames, double click to add new frames. Press export button (tree horizontal lines) to export code you can then copy paste in your scrip .

In this case we have to specify targetName in anim() that will be used when we export the code from the timeline GUI. For each property used in to() call there will be an animation track created. Animation data is stored in localStorage and shared between sessions so refreshing the page and adding new properties and objects to be animated is possible. When an animation track exists in localStorage all to() calls modifying this property are ignored.

2.1 Example

anim("rect", rect).to({x:rect.x, y:rect.y});

Add the rect object and it's x and y properties to animation and use their default values. Target name should be always exactly the same as variable name.

3. Node.js

First install the timeline-js package from npm

npm install timeline-js

And then

var timeline = require('timeline-js');
var Timeline = timeline.Timeline;
var anim = timeline.anim;

anim(target).to(delay, {property:value,...}, duration, easing);

More Repositories

1

pragmatic-pbr

JavaScript
158
star
2

MowaLibs

Collection of my C++ classes that I use together with CinderLib
C++
99
star
3

kollektor

Node app for image collection and mood boards (like Pinterest)
JavaScript
82
star
4

pex-experiments

Collection of experiments for the pex library
JavaScript
42
star
5

pbr-compare

JavaScript
42
star
6

webgl-debug

WebGL Debug Utils
JavaScript
33
star
7

geom-sweep

Extrudes a shape along a path
JavaScript
28
star
8

pex-exp-deferred-rendering

Deferred rendering with sphere clipped lights in WebGL
JavaScript
19
star
9

interpolate-angle

Linear interpolation between two angles along the shorter arc
JavaScript
16
star
10

primitive-rounded-cube

A rounded cube geometry for 3D rendering, including normals, UVs and cell indices (faces).
JavaScript
16
star
11

spline-points

Subdivides path into spline points
JavaScript
15
star
12

get-image-urls

Scrape image urls from HTML website including CSS background images.
JavaScript
15
star
13

geom-builder

Simplicial-complex-like geometry builder backed by typed arrays
JavaScript
14
star
14

interpolate-arrays

Linear interpolation between multiple arrays
JavaScript
13
star
15

geom-revolve

Create geometry by revolving path around Y axis
JavaScript
13
star
16

pex-exp-deferred-rendering-explained

Deferred rendering blog post code
JavaScript
13
star
17

primitive-cube

A minimal cube geometry for 3D rendering, including normals, UVs and cell indices (faces).
JavaScript
11
star
18

fit-rect

Fits one rectangle into another
JavaScript
10
star
19

pex-20001-webgpu

JavaScript
9
star
20

cosine-gradient

Cosine gradient generator
HTML
9
star
21

running-maps

Aligning NikePlus GPS runs data to OpenStreetMap street paths
JavaScript
9
star
22

geom-merge

Merges multiple geometries into one
JavaScript
9
star
23

geom-split-vertices

Creates new geometry with unique vertices for each face.
JavaScript
9
star
24

geom-triangulate

Splits quad or polygon faces into triangles
HTML
8
star
25

nodes-stream

Source code for come of my experiments streamed live
JavaScript
8
star
26

geom-half-edge

Half-Edge Mesh utils for simplical complex geometry
JavaScript
8
star
27

geom-center-and-normalize

Centers the geometry and scales it to fill 1x1x1 bounding box
JavaScript
7
star
28

primitive-plane

Plane geometry including UVs and normals
JavaScript
7
star
29

pex-exp-topo-world

Rendering topo-json world map
JavaScript
6
star
30

glslify-sync

A synchronous wrapper for glslify, providing a consistent interface between both Node.js and browserify
JavaScript
6
star
31

primitive-capsule

A minimal capsule geometry for 3D rendering, including normals, UVs and cell indices (faces).
JavaScript
6
star
32

grid-cells

Computes grid cells coordinates
JavaScript
5
star
33

screenshot-viz

JavaScript
5
star
34

geom-parse-obj

Parse OBJ geometry files
JavaScript
5
star
35

pex-exp-point-light-shadows

Omnidirectional point light shadows
JavaScript
4
star
36

geom-edges

Computes unique edges for a list of faces
JavaScript
4
star
37

geom-normals

Compute normals for the geometry based on faces/cells information
JavaScript
4
star
38

pex-exp-tile-render

JavaScript
4
star
39

pex-exp-modules

An attempt to break pex into loosely coupled node modules to be installed from npm.
JavaScript
4
star
40

pex-20006-refraction

JavaScript
3
star
41

droptasks

Web UI for taskpaper files taking advantage of your whole screen
JavaScript
3
star
42

autoperf

JavaScript
3
star
43

primitive-box

A minimal box geometry for 3D rendering, NOT including normals, UVs. Only vertices and cell indices (faces).
JavaScript
3
star
44

parse-hdr

Parses HDR (Radiance) file
JavaScript
3
star
45

ciid-simulations-and-artificial-behaviours-2014

ciid-simulations-and-artificial-behaviours-2014
JavaScript
3
star
46

spatial-index

Spatial index
JavaScript
3
star
47

atom-mac-terminal

Opens selected file in a new Terminal tab on OSX
JavaScript
3
star
48

dex

JSON data explorer
JavaScript
3
star
49

image-wall

Image organisation 'mind mapping' style
JavaScript
2
star
50

xyz-to-latlon

Converts x,y,z position on a unit sphere to latutude,longitude
JavaScript
2
star
51

mowa.cc

My OpenGL ES 2.0 experiments
C++
2
star
52

hammersley

Computes i-th point in a Hammersley Point Set of size n
JavaScript
2
star
53

vorg.github.com

Just assets for now
1
star
54

dotfiles

Shell
1
star
55

pocket-viz

Visualizes you Pocket app added vs archived article counts
JavaScript
1
star
56

gifgen

GIF Builder from image sequence
JavaScript
1
star
57

RAM

Remote Access Memory
JavaScript
1
star
58

latlon-to-xyz

Convert latitude,longitude to x,y,z position on a unit sphere
JavaScript
1
star