Skip to content

Commit

Permalink
Moving ui stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
zz85 committed May 18, 2020
1 parent 7946113 commit 8e8d874
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 48 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ Include the timeliner.js file.
<script src="timeliner.js"></script>
```

or import via ES modules

```js
import { Timeliner } from './build/timeliner.min.js'
```

Load data by code, file upload or loading from saved localStorage.

```js
Expand Down Expand Up @@ -87,6 +93,9 @@ yarn run mini

## Releases

2.0.0
- Refactored using ES modules

1.5.0
- Fix package.json dependencies
- Easy way to move keyframes (reimplemented block dragging)
Expand Down
16 changes: 0 additions & 16 deletions src/settings.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/timeliner.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface LayerProp {

export class Timeliner {
constructor(target: Object);
setTarget(target: Object);
setTarget(target: Object): void;
openLocalSave(): void;
save(): void;
load(): void;
Expand Down
5 changes: 2 additions & 3 deletions src/timeliner.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import { LayoutConstants as Settings } from './layout_constants.js';
import { utils } from './utils.js'
import { LayerCabinet } from './view_layer_cabinet.js'
import { TimelinePanel } from './view_panel.js'
import { IconButton } from './ui_icon_button.js'
import { IconButton } from './ui/ui_icon_button.js'
var style = utils.style
var saveToFile = utils.saveToFile
var openAs = utils.openAs
var STORAGE_PREFIX = utils.STORAGE_PREFIX
import { ScrollBar } from './ui_scrollbar.js'
import { ScrollBar } from './ui/ui_scrollbar.js'
import { DataStore } from './util_datastore.js'
import { DockingWindow } from './utils/docking_window.js'

Expand Down Expand Up @@ -720,7 +720,6 @@ function Timeliner(target) {
var scrollable_height = Settings.TIMELINE_SCROLL_HEIGHT;

scrollbar.setHeight(scrollable_height - 2);
// scrollbar.setThumb

style(scrollbar.dom, {
top: Settings.MARKER_TRACK_HEIGHT + 'px',
Expand Down
2 changes: 1 addition & 1 deletion src/ui_canvas.js → src/ui/ui_canvas.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { handleDrag } from './util_handle_drag.js';
import { handleDrag } from '../util_handle_drag.js';

function Canvas(w, h) {

Expand Down
6 changes: 3 additions & 3 deletions src/ui_icon_button.js → src/ui/ui_icon_button.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { font } from './font.js'
import { Theme } from './theme.js'
import { utils } from './utils.js'
import { font } from '../font.js'
import { Theme } from '../theme.js'
import { utils } from '../utils.js'
const { style } = utils

function IconButton(size, icon, tooltip, dispatcher) {
Expand Down
8 changes: 4 additions & 4 deletions src/ui_number.js → src/ui/ui_number.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Theme } from './theme.js'
import { Do } from './utils/do.js'
import { handleDrag } from './util_handle_drag.js'
import { utils } from './utils.js'
import { Theme } from '../theme.js'
import { Do } from '../utils/do.js'
import { handleDrag } from '../util_handle_drag.js'
import { utils } from '../utils.js'
const { firstDefined, style } = utils
;

Expand Down
4 changes: 2 additions & 2 deletions src/ui_scrollbar.js → src/ui/ui_scrollbar.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Do } from './utils/do.js'
import { utils } from './utils.js'
import { Do } from '../utils/do.js'
import { utils } from '../utils.js'

// ********** class: ScrollBar ****************** //
/*
Expand Down
2 changes: 1 addition & 1 deletion src/view_layer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Theme } from './theme.js'
import { UINumber } from './ui_number.js'
import { UINumber } from './ui/ui_number.js'
import { Tweens } from './util_tween.js'
import { LayoutConstants } from './layout_constants.js'
import { utils } from './utils.js'
Expand Down
4 changes: 2 additions & 2 deletions src/view_layer_cabinet.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { LayoutConstants } from './layout_constants.js'
import { LayerView } from './view_layer.js'
import { IconButton } from './ui_icon_button.js'
import { IconButton } from './ui/ui_icon_button.js'
import { utils } from './utils.js'
import { Theme } from './theme.js'
import { UINumber } from './ui_number.js'
import { UINumber } from './ui/ui_number.js'


const { STORAGE_PREFIX, style } = utils
Expand Down
2 changes: 1 addition & 1 deletion src/view_panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { utils } from './utils.js'
import { Tweens } from './util_tween.js'
import { handleDrag } from './util_handle_drag.js'
import { ScrollCanvas } from './view_time_scroller.js'
import { Canvas } from './ui_canvas.js'
import { Canvas } from './ui/ui_canvas.js'

const proxy_ctx = utils.proxy_ctx;

Expand Down
6 changes: 3 additions & 3 deletions test.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@

// timeliner.load({"version":"1.3.0","modified":"Tue Dec 16 2014 10:27:28 GMT+0800 (SGT)","title":"Untitled","layers":[{"name":"a","values":[],"_value":0,"_color":"#9ab426"}],"name":"simple"});

var w2 = window.innerWidth / 2;
var h2 = window.innerHeight / 2;

function animate() {
requestAnimationFrame(animate);

var w2 = window.innerWidth / 2;
var h2 = window.innerHeight / 2;

box.style.transform = 'translateX(' + (target.x * 100 + w2) + 'px) translateY(' + (target.y * 100 + h2) + 'px) rotate(' + target.rotate * 50 + 'deg)';
}

Expand Down
18 changes: 7 additions & 11 deletions test_module.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,25 @@

// initialize timeliner
var timeliner = new Timeliner(target);
// timeliner.addLayer('x');
// timeliner.addLayer('y');
// timeliner.addLayer('rotate');

// var o = {"version":"1.2.0","modified":"Mon Dec 08 2014 10:41:11 GMT+0800 (SGT)","title":"Untitled", "layers": [{"name":"x","values":[],"tmpValue":0,"_color":"#10b00d"},{"name":"y","values":[{"time":0,"value":-1.2999770000000004,"_color":"#4a2392","tween":"quadEaseIn"},{"time":3.3,"value":-1.1999850000000003,"_color":"#cddfd8"}],"tmpValue":-1.2999770000000004,"_color":"#344260"},{"name":"rotate","values":[{"time":0,"value":4.200005,"_color":"#ec9bb5","tween":"quadEaseInOut"},{"time":2.1,"value":28.000009,"_color":"#ac8e14","tween":"quadEaseIn"},{"time":5,"value":50.400018,"_color":"#5c659"}],"tmpValue":50.400018,"_color":"#1fa995"}]};
// timeliner.load(o);

timeliner.addLayer('x');
timeliner.addLayer('y');
timeliner.addLayer('rotate');

timeliner.load({"version":"1.2.0","modified":"Mon Dec 08 2014 10:41:11 GMT+0800 (SGT)","title":"Untitled","layers":[{"name":"x","values":[{"time":0.1,"value":0,"_color":"#893c0f","tween":"quadEaseIn"},{"time":3,"value":3.500023,"_color":"#b074a0"}],"tmpValue":3.500023,"_color":"#6ee167"},{"name":"y","values":[{"time":0.1,"value":0,"_color":"#abac31","tween":"quadEaseOut"},{"time":0.5,"value":-1.000001,"_color":"#355ce8","tween":"quadEaseIn"},{"time":1.1,"value":0,"_color":"#47e90","tween":"quadEaseOut"},{"time":1.7,"value":-0.5,"_color":"#f76bca","tween":"quadEaseOut"},{"time":2.3,"value":0,"_color":"#d59cfd"}],"tmpValue":-0.5,"_color":"#8bd589"},{"name":"rotate","values":[{"time":0.1,"value":-25.700014000000003,"_color":"#f50ae9","tween":"quadEaseInOut"},{"time":2.8,"value":0,"_color":"#2e3712"}],"tmpValue":-25.700014000000003,"_color":"#2d9f57"}]});

// timeliner.load({"version":"1.3.0","modified":"Tue Dec 16 2014 10:27:28 GMT+0800 (SGT)","title":"Untitled","layers":[{"name":"a","values":[],"_value":0,"_color":"#9ab426"}],"name":"simple"});

var w2 = window.innerWidth / 2;
var h2 = window.innerHeight / 2;

function animate() {
requestAnimationFrame(animate);

var w2 = window.innerWidth / 2;
var h2 = window.innerHeight / 2;

box.style.transform = 'translateX(' + (target.x * 100 + w2) + 'px) translateY(' + (target.y * 100 + h2) + 'px) rotate(' + target.rotate * 50 + 'deg)';
}

animate();


</script>
</body>
</html>

0 comments on commit 8e8d874

Please sign in to comment.