Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animation widget #458

Merged
merged 182 commits into from
Feb 25, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
182 commits
Select commit Hold shift + click to select a range
781899f
Experimenting with SVG.
emackey Oct 23, 2012
40194f6
Testing SVG events.
emackey Oct 24, 2012
95427aa
Merge remote-tracking branch 'origin/master' into playback
emackey Oct 29, 2012
65a5591
TimelineDemo - Add animation loop.
emackey Oct 29, 2012
5b3f15a
TimelineDemo tweaks.
emackey Oct 29, 2012
678439b
Merge remote-tracking branch 'origin/master' into playback
emackey Oct 31, 2012
5c050e0
Merge remote-tracking branch 'origin/master' into playback
emackey Nov 19, 2012
8fb6d7a
Add a background behind widgets in TimelineDemo.
emackey Nov 19, 2012
e9fe0c4
Imported buttons from SVG tests.
emackey Nov 19, 2012
aa5e95f
Started hookup of Playback widget to animationController.
emackey Nov 19, 2012
d3189d0
Playback tooltips, unpause, and ressurect the timeline darker theme.
emackey Nov 19, 2012
8fdcfd7
Tweak playback widget position, and flip ring animation inside out.
emackey Nov 19, 2012
80df00a
Make the large button hide the shuttle ring.
emackey Nov 19, 2012
b4d9477
Hookup shuttle ring to animationController.
emackey Nov 19, 2012
c2b837a
Style and behavior tweaks for playback and timeline widgets.
emackey Nov 20, 2012
9a882c1
Shuttle ring angle updates during Playback.update().
emackey Nov 20, 2012
c2ddc96
Remove debug messages.
emackey Nov 20, 2012
011900a
Tweak animation to make sure ring fully disappears.
emackey Nov 20, 2012
ab4dc82
Apply new Playback widget to CesiumViewerWidget.
emackey Nov 20, 2012
32f0e22
Added a workaround for Firefox, only to reveal a new problem (which m…
emackey Nov 21, 2012
005a7c2
Fixed another SVG issue. Seems to work on Firefox desktop & mobile n…
emackey Nov 21, 2012
bbb8591
Improvements to playback.update(), and disable timeline hover glow.
emackey Nov 22, 2012
7da6259
Merge remote-tracking branch 'origin/master' into playback
emackey Nov 23, 2012
37bc828
Renamed ClockStep.SYSTEM_CLOCK_DEPENDENT to ClockStep.SPEED_MULTIPLIE…
emackey Nov 23, 2012
d6b8366
Hookup realtime button.
emackey Nov 23, 2012
bc29c6f
Improve test coverage for Clock and AnimationController.
emackey Nov 23, 2012
8a6f01d
Faster/Slower pop out of pause and realtime mode now.
emackey Nov 25, 2012
23a6cac
Remove the realtime button when realtime mode is not available.
emackey Nov 28, 2012
ffe6f5e
Added a "Hide shuttle ring" button, separate from the main button.
emackey Nov 29, 2012
14c14ff
Fix bug with un-pausing during faster/slower.
emackey Nov 29, 2012
967c26e
Add a "playback" prefix to IDs and classes used by the widget.
emackey Nov 29, 2012
9c908d3
Fix bug where clicking the center of the large button didn't work dur…
emackey Nov 29, 2012
437b11e
New AnimationController.playRealtime() method with unit tests.
emackey Nov 30, 2012
015bc55
Trying a new style for the shuttle ring.
emackey Dec 3, 2012
050fc4e
Permanent shuttle ring.
emackey Dec 3, 2012
754baef
More work on the new look. Not done yet.
emackey Dec 3, 2012
c9750d6
Overhaul the way the ring fits together.
emackey Dec 4, 2012
93c03f0
Added knob gradients and pause button.
emackey Dec 4, 2012
54bf7f5
Playback - Misc cleanup
emackey Dec 4, 2012
6267aea
Change speed up/down to forward/reverse buttons, gray out Realtime wh…
emackey Dec 4, 2012
a520a2e
Remove background gradient, make knobOuter clickable (after watching …
emackey Dec 4, 2012
eef2ee6
Push buttons closer together.
emackey Dec 4, 2012
c899acf
Usability tweak.
emackey Dec 4, 2012
eac65ca
Working on playback widget usability. Not done yet.
emackey Dec 5, 2012
6679ad3
Made the ring pointer itself act as a play forward/backward button.
emackey Dec 5, 2012
8ab1926
Another option, with play/reverse buttons as disappearing mouse ears.
emackey Dec 5, 2012
3d5b55b
More usability tweaking.
emackey Dec 5, 2012
24809b8
Trying out new "wing" buttons.
emackey Dec 6, 2012
dd48c20
Expand range of typical speeds, and limit widget to those speeds.
emackey Dec 6, 2012
9497951
Implemented some of Kevin Murray's suggestions about adjusting speeds…
emackey Dec 6, 2012
d8273e4
Use the ring itself as the speed increment buttons.
emackey Dec 6, 2012
763121f
Make widget behavior a little smoother at the top, and use angles for…
emackey Dec 6, 2012
f10c9a3
Move the realtime button to the left wing.
emackey Dec 6, 2012
8fe2e06
Refine the look a little.
emackey Dec 6, 2012
d740f27
Code cleanup
emackey Dec 6, 2012
9652de9
Make "LOOP" mode one-way, so you can animate back to the start time.
emackey Dec 6, 2012
da77200
Merge remote-tracking branch 'origin/camera' into playbackAndCamera
emackey Dec 7, 2012
fc7a1ac
Merge remote-tracking branch 'origin/master' into playback
emackey Dec 16, 2012
d162f57
Merge remote-tracking branch 'origin/master' into playback
emackey Dec 19, 2012
11b7446
Tweak styling.
emackey Dec 19, 2012
24bfbd6
Merge remote-tracking branch 'origin/color' into playback
emackey Dec 19, 2012
22b7c23
Start implementing color theme for widget. Work in progress.
emackey Dec 19, 2012
b49a685
Working on some sample light/dark themes. Work in progress.
emackey Dec 20, 2012
5def181
More work on getting CSS values to affect SVG gradients.
emackey Dec 20, 2012
c1cea58
Started work on themeing the knob, plus minor tweaks.
emackey Dec 21, 2012
2b56635
Working on knob's theme
emackey Dec 21, 2012
6f7f9ec
Add themes to pointer & swoosh elements.
emackey Dec 21, 2012
95503e7
Merge remote-tracking branch 'origin/color' into playback
emackey Dec 22, 2012
8509ba8
Fix after merge.
emackey Dec 22, 2012
3dc4573
Merge remote-tracking branch 'origin/toIso8601' into playback
emackey Jan 2, 2013
a0bbc42
Use new GregorianDate to display leap seconds, and provide functions …
emackey Jan 2, 2013
6b1ebd6
Merge remote-tracking branch 'origin/master' into playback
emackey Jan 2, 2013
9bca534
Fix after merge.
emackey Jan 2, 2013
d683016
Merge remote-tracking branch 'origin/color' into playback
emackey Jan 4, 2013
24c2cf9
Merge remote-tracking branch 'origin/color' into playback
emackey Jan 9, 2013
6060e7f
Tweak timeline demo colors.
emackey Jan 9, 2013
a479404
Rebuild logos if the offset changes.
kring Jan 9, 2013
2650267
Merge remote-tracking branch 'origin/master' into playback
emackey Jan 9, 2013
d3560bb
Merge remote-tracking branch 'origin/logoOffset' into playback
emackey Jan 11, 2013
6aafbac
Merge remote-tracking branch 'origin/master' into playback
emackey Jan 11, 2013
7d288f0
Move imagery credits to visible location.
emackey Jan 11, 2013
a37924c
Remove Bing logo from imagery selector.
emackey Jan 11, 2013
fa7370f
Change opacity of shuttle ring.
emackey Jan 11, 2013
ac83df8
Tests & code coverage for Clock & AnimationController.
emackey Jan 11, 2013
d9f87e9
Merge remote-tracking branch 'origin/master' into playback
emackey Jan 16, 2013
12b096e
Add Playback.setScale() and make the default scale smaller.
emackey Jan 16, 2013
ba3ae3e
Fix Timeline Demo
emackey Jan 16, 2013
3a8dfcc
Begin rename of Playback to Animation.
emackey Jan 16, 2013
fc31679
Rename Playback widget to Animation widget.
emackey Jan 16, 2013
b6474c2
Update documentation and CHANGES.md
emackey Jan 16, 2013
fe7c53a
Merge remote-tracking branch 'origin/master' into playback
emackey Jan 17, 2013
78238b7
Fix an issue with CSS minification.
emackey Jan 17, 2013
b28dac4
Remove two widget images that are no longer used.
emackey Jan 17, 2013
c301d32
Merge remote-tracking branch 'origin/master' into playback
emackey Jan 22, 2013
09ff708
Update CHANGES.md
emackey Jan 22, 2013
56a2d57
Add sanity check for getTypicalSpeed per @pjcozzi
emackey Jan 22, 2013
396d4cc
Added getScale and some doc tweaks.
emackey Jan 22, 2013
02e08ac
Add example usage.
emackey Jan 22, 2013
f3038dc
Merge branch 'master' into playback
mramato Jan 28, 2013
a47a568
Start of animation widget tweaks and clean up.
mramato Jan 28, 2013
7fd478f
Merge branch 'master' into playback
mramato Jan 28, 2013
d8c9341
Merge branch 'playback' into playbackTweaks
mramato Jan 28, 2013
d031781
Fix build do to missing module import.
mramato Jan 28, 2013
632a85c
Some additional Animation cleanup before major refactoring.
mramato Jan 30, 2013
262ef93
Start of an AnimationViewModel.
mramato Jan 30, 2013
fafe870
Merge remote-tracking branch 'origin/master' into playback
emackey Jan 30, 2013
e5fe701
Ongoing viewModel refactoring.
mramato Jan 30, 2013
d27ead7
Merge branch 'master' into playback
mramato Jan 31, 2013
15fac01
Merge branch 'playback' into playbackTweaks
mramato Jan 31, 2013
2238ab8
Merge remote-tracking branch 'origin/master' into playback
emackey Jan 31, 2013
d5f3334
Update LICENSE.md
emackey Jan 31, 2013
69b84f5
Start using knockout.
mramato Jan 31, 2013
0addc53
Merge remote-tracking branch 'origin/playback' into playbackTweaks
mramato Jan 31, 2013
789e432
Ongoing MVVM refactoring
mramato Jan 31, 2013
c98aa4b
Merge remote-tracking branch 'origin/master' into playbackTweaks
mramato Jan 31, 2013
88b45c2
Some cleanup to Animation.js
mramato Jan 31, 2013
c18a1f3
Merge remote-tracking branch 'origin/master' into playback
emackey Feb 1, 2013
0830000
Update CHANGES.md
emackey Feb 1, 2013
37227f0
Ongoing refactoring.
mramato Feb 1, 2013
10f73c0
Merge remote-tracking branch 'origin/playback' into playbackTweaks
mramato Feb 1, 2013
6f28ea4
Merge remote-tracking branch 'origin/master' into playback
emackey Feb 1, 2013
5114380
Make it possible to share animation between widgets.
mramato Feb 1, 2013
9deae53
Merge branch 'playback' into playbackTweaks
mramato Feb 1, 2013
2680e48
Fix client CZML and Two Viewer Widgets demos, which broke due to chan…
mramato Feb 1, 2013
6c6a279
First pass on documentation and some minor cleanup.
mramato Feb 4, 2013
b467444
Rename SYSTEM_CLOCK_DEPENDENT to SYSTEM_CLOCK_MULTIPLIER.
emackey Feb 4, 2013
ef33d25
Restore docs for SYSTEM_CLOCK_TIME.
emackey Feb 4, 2013
dc6b2aa
Fix enum
emackey Feb 4, 2013
69e6794
Comments
emackey Feb 4, 2013
6123c76
Merge branch 'master' into playback
mramato Feb 6, 2013
edea18f
Merge branch 'playback' into playbackTweaks
mramato Feb 6, 2013
53d4d0f
Fix issues found during review.
mramato Feb 6, 2013
b735377
Ongoing cleanup
mramato Feb 6, 2013
22027dc
More cleanup, start of tests.
mramato Feb 7, 2013
713bd44
ClockViewModel specs
mramato Feb 7, 2013
04c752b
More AnimationViewModel Specs
mramato Feb 7, 2013
e531353
Hopefully last set of AnimationViewModel specs
mramato Feb 7, 2013
16b1b49
More cleanup.
mramato Feb 7, 2013
2a21f9b
More clock refactoring
mramato Feb 7, 2013
3efc9dd
Fix a bug I introduced.
mramato Feb 7, 2013
5955924
More clean up and bugfixes
mramato Feb 8, 2013
84f3406
Hopefully final round of doc/clean/tests before merging.
mramato Feb 8, 2013
78b1bcb
Remove shotty test that was relying on system clock.
mramato Feb 8, 2013
e6de407
Merge remote-tracking branch 'origin/master' into playback
emackey Feb 8, 2013
72780f0
Merge remote-tracking branch 'origin/playback' into playbackTweaks
emackey Feb 8, 2013
740d871
Fix problems found during review.
mramato Feb 8, 2013
1794e9a
Fix
emackey Feb 8, 2013
bfb5248
Merge pull request #501 from AnalyticalGraphicsInc/playbackTweaks
emackey Feb 8, 2013
eb340e7
Make the number of ticks in the shuttle ring user-settable.
mramato Feb 11, 2013
2ff8264
Rename most speed refernces to multipler so that its consistent with …
mramato Feb 11, 2013
f3153c8
Get rid of setScale & getScale.
mramato Feb 11, 2013
1e552e6
Fix issues with CSS sizing.
mramato Feb 12, 2013
cbb5c01
Minor template cleanup.
emackey Feb 12, 2013
e2134fc
Revert a mistaken change I made.
emackey Feb 14, 2013
567276e
Merge remote-tracking branch 'origin/master' into playback
emackey Feb 14, 2013
07e10f8
Recover the finer usability points of the original playback widget.
emackey Feb 14, 2013
7f8ec41
Merge branch 'master' into playback
mramato Feb 15, 2013
92203b3
Merge branch 'master' into playback
mramato Feb 15, 2013
4de2d1b
Add more documentation, use Date.now() instead of constructing throwa…
shunter Feb 18, 2013
a118c70
Merge remote-tracking branch 'origin/master' into playback
emackey Feb 18, 2013
e4c78bc
First round of changes after review.
mramato Feb 19, 2013
68e1046
Rename knockout to not include version number.
mramato Feb 19, 2013
be6d5da
Changes after review.
mramato Feb 19, 2013
916a7d5
Replace Command constructor with a createCommand function that return…
shunter Feb 19, 2013
8734cab
Widget reorganization
mramato Feb 21, 2013
49b5759
More changes after review.
mramato Feb 21, 2013
9f50603
Remove underscores for consistency with rest of codebase.
mramato Feb 21, 2013
8e125ed
More changes after review.
mramato Feb 21, 2013
dd163b5
Tooltip is one word.
mramato Feb 21, 2013
a8bdb2f
Documentation cleanup.
mramato Feb 22, 2013
7363f09
Hopefully final review changes.
mramato Feb 22, 2013
51693cb
Fix SandCastle example.
mramato Feb 22, 2013
479439c
Update CHANGES to accurately reflect everything.
mramato Feb 22, 2013
0320e9d
Merge remote-tracking branch 'origin/master' into playback
mramato Feb 22, 2013
af0f585
Fix height of widget in Timeline Demo.
emackey Feb 24, 2013
390f48d
Touch controls for animation widget.
emackey Feb 24, 2013
f363e12
Merge pull request #530 from AnalyticalGraphicsInc/animation-touch
mramato Feb 25, 2013
0b30be4
Fix typos in documentation.
shunter Feb 25, 2013
186b1b1
Fix typos in documentation.
shunter Feb 25, 2013
acd9167
fix documentation for createCommand
shunter Feb 25, 2013
8d80b7c
Fix Dojo build process by including EnvJS while running the build, so…
shunter Feb 25, 2013
c988db5
Fix typos.
shunter Feb 25, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .settings/.jsdtscope
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="Source/ThirdParty/Tween.js|Source/ThirdParty/Uri.js|Source/ThirdParty/sprintf.js|Source/ThirdParty/when.js|Source/Workers/cesiumWorkerBootstrapper.js|ThirdParty/" kind="src" path=""/>
<classpathentry excluding="Source/ThirdParty/|Source/Workers/cesiumWorkerBootstrapper.js|ThirdParty/" kind="src" path=""/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary/StandardBrowser/html5"/>
<classpathentry kind="output" path=""/>
Expand Down
2 changes: 1 addition & 1 deletion .settings/com.eclipsesource.jshint.ui.prefs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
eclipse.preferences.version=1
excluded=Apps/Sandcastle/Cesium-hint.js\:Source/ThirdParty/Chain.js\:Source/ThirdParty/Tween.js\:Source/ThirdParty/Uri.js\:Source/ThirdParty/sprintf.js\:Source/ThirdParty/when.js\:Source/Workers/cesiumWorkerBootstrapper.js\:ThirdParty//*
excluded=Apps/Sandcastle/Cesium-hint.js\:Source/ThirdParty//*\:Source/Workers/cesiumWorkerBootstrapper.js\:ThirdParty//*
included=//*.js
options=bitwise \: false,\r\ncamelcase \: false,\r\ncurly \: true,\r\neqeqeq \: true,\r\nforin \: true,\r\nimmed \: false,\r\nlatedef \: true,\r\nnewcap \: true,\r\nnoarg \: true,\r\nnoempty \: false,\r\nnonew \: true,\r\nplusplus \: false,\r\nquotmark \: false,\r\nregexp \: false,\r\nundef \: true,\r\nunused \: false,\r\nstrict \: true,\r\ntrailing \: true,\r\nasi \: false,\r\nboss \: false,\r\ndebug \: false,\r\neqnull \: false,\r\nes5 \: false,\r\nesnext \: false,\r\nevil \: false,\r\nexpr \: false,\r\nfuncscope \: false,\r\nglobalstrict \: false,\r\niterator \: false,\r\nlastsemic \: false,\r\nlaxbreak \: false,\r\nlaxcomma \: false,\r\nloopfunc \: false,\r\nmultistr \: false,\r\nonecase \: false,\r\nproto \: false,\r\nregexdash \: false,\r\nscripturl \: false,\r\nsmarttabs \: false,\r\nshadow \: false,\r\nsub \: false,\r\nsupernew \: false,\r\nvalidthis \: false,\r\nbrowser \: true
projectSpecificOptions=true
9 changes: 3 additions & 6 deletions Apps/Sandcastle/gallery/Client CZML.html
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
clock.startTime = availability.start.clone();
clock.currentTime = availability.start.clone();
clock.stopTime = availability.stop.clone();
clock.clockRange = Cesium.ClockRange.LOOP;
clock.clockRange = Cesium.ClockRange.LOOP_STOP;

return visualizers;
}
Expand All @@ -137,18 +137,15 @@
widget.startup();

var visualizers = addCZML(czml, widget.scene, widget.clock);
widget.timelineControl.zoomTo(widget.clock.startTime, widget.clock.stopTime);
widget.timeline.zoomTo(widget.clock.startTime, widget.clock.stopTime);

// Let's make the playback speed faster
widget.clock.multiplier = 300.0;

// Custom render loop adapted from CesiumViewerWidget.startRenderLoop()
var animationController = widget.animationController;

function updateAndRender() {
var currentTime = animationController.update();
widget.initializeFrame();
widget.update(currentTime);
var currentTime = widget.update();

// Update the visualizers...
visualizers.update(currentTime);
Expand Down
27 changes: 8 additions & 19 deletions Apps/Sandcastle/gallery/Two Viewer Widgets.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"use strict";

// This example shows two widgets that share a single
// animationController. It is also possible to use
// separate animationControllers to show a scene at
// animation view model. It is also possible to use
// separate view models to show a scene at
// different times.

var endUserOptions = {
Expand All @@ -53,20 +53,16 @@
endUserOptions : endUserOptions,
autoStartRenderLoop : false
});
widget1.placeAt("cesiumContainerTop");
widget1.placeAt('cesiumContainerTop');
widget1.startup();

// Save off a copy of widget1's animationController
var animationController = widget1.animationController;

// Now create widget2, passing in the
// existing animationController to be shared.
// Use widget1's animationViewModel in widget2
var widget2 = new CesiumViewerWidget({
animationController : animationController,
animationViewModel : widget1.animation.viewModel,
endUserOptions : endUserOptions,
autoStartRenderLoop : false
});
widget2.placeAt("cesiumContainerBottom");
widget2.placeAt('cesiumContainerBottom');
widget2.startup();

// Switch widget2 to Columbus View.
Expand All @@ -75,15 +71,8 @@
// Now both widgets are created. A custom render loop is
// needed to drive them both from requestAnimationFrame.
function updateAndRender() {
// Get the time from the shared controller, then
// update and render both widgets.
var currentTime = animationController.update();
widget1.initializeFrame();
widget2.initializeFrame();
widget1.update(currentTime);
widget2.update(currentTime);
widget1.render(currentTime);
widget2.render(currentTime);
widget1.updateAndRender();
widget2.updateAndRender();
requestAnimationFrame(updateAndRender);
}

Expand Down
72 changes: 61 additions & 11 deletions Apps/TimelineDemo/TimelineDemo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,32 @@
define(['dojo',
'dijit/dijit',
'Core/Clock',
'Core/ClockRange',
'Core/Color',
'Core/JulianDate',
'Core/TimeInterval',
'Widgets/Timeline'
'Core/requestAnimationFrame',
'Widgets/Animation/Animation',
'Widgets/ClockViewModel',
'Widgets/Animation/AnimationViewModel',
'Widgets/Timeline/Timeline'
], function(
dojo,
dijit,
Clock,
ClockRange,
Color,
JulianDate,
TimeInterval,
requestAnimationFrame,
Animation,
ClockViewModel,
AnimationViewModel,
Timeline) {
"use strict";

var startDatePart, endDatePart, startTimePart, endTimePart;
var timeline, clock, endBeforeStart, timeElement;
var timeline, clock, endBeforeStart, containerElement, animationViewModel, animation;

function updateScrubTime(julianDate) {
document.getElementById('mousePos').innerHTML = timeline.makeLabel(julianDate) + ' UTC';
Expand All @@ -26,6 +36,7 @@ define(['dojo',
function handleSetTime(e) {
if (typeof timeline !== 'undefined') {
var scrubJulian = e.timeJulian;
clock.shouldAnimate = false;
clock.currentTime = scrubJulian;
updateScrubTime(scrubJulian);
}
Expand Down Expand Up @@ -60,26 +71,41 @@ define(['dojo',
//'<br/>Epoch: ' + timeline.makeLabel(e.epochJulian) + ' UTC' +
'<br/>Start: ' + timeline.makeLabel(e.startJulian) + ' UTC' +
'<br/>&nbsp;Stop: ' + timeline.makeLabel(e.endJulian) + ' UTC' +
'<br/>Span: ' + spanToString(e.totalSpan) +
'<br/>Tic: ' + spanToString(e.mainTicSpan);
'<br/>&nbsp;Span: ' + spanToString(e.totalSpan) +
'<br/>&nbsp;&nbsp;Tic: ' + spanToString(e.mainTicSpan);
updateScrubTime(clock.currentTime);
}

function makeTimeline(startJulian, scrubJulian, endJulian) {
clock = new Clock({
startTime : startJulian,
currentTime : scrubJulian,
stopTime : endJulian
stopTime : endJulian,
clockRange : ClockRange.LOOP_STOP,
multiplier : 60,
shouldAnimate : true
});

timeline = new Timeline('time1', clock);
timeline.addEventListener('settime', handleSetTime, false);
timeline.addEventListener('setzoom', handleSetZoom, false);

timeline.addTrack(new TimeInterval(startJulian, startJulian.addSeconds(60*60)), 8, Color.RED, new Color(0.75, 0.75, 0.75, 0.5));
timeline.addTrack(new TimeInterval(endJulian.addSeconds(-60*60), endJulian), 8, Color.GREEN);
timeline.addTrack(new TimeInterval(startJulian, startJulian.addSeconds(60 * 60)), 8, Color.RED, new Color(0.55, 0.55, 0.55, 0.25));
timeline.addTrack(new TimeInterval(endJulian.addSeconds(-60 * 60), endJulian), 8, Color.LIME);
var middle = startJulian.getSecondsDifference(endJulian) / 4;
timeline.addTrack(new TimeInterval(startJulian.addSeconds(middle), startJulian.addSeconds(middle * 3)), 8, Color.BLUE, new Color(0.75, 0.75, 0.75, 0.5));
timeline.addTrack(new TimeInterval(startJulian.addSeconds(middle), startJulian.addSeconds(middle * 3)), 8, Color.DEEPSKYBLUE, new Color(0.55, 0.55, 0.55, 0.25));

var clockViewModel = new ClockViewModel(clock);
animationViewModel = new AnimationViewModel(clockViewModel);
animation = new Animation(dojo.byId('animationWidget'), animationViewModel);

function tick() {
var time = clock.tick();
timeline.updateFromClock();
updateScrubTime(time);
requestAnimationFrame(tick);
}
tick();
}

// Adjust start/end dates in reaction to any calendar/time clicks
Expand All @@ -97,10 +123,10 @@ define(['dojo',
if (startJulian && endJulian) {
if (startJulian.getSecondsDifference(endJulian) < 0.1) {
endBeforeStart.style.display = 'block';
timeElement.style.visibility = 'hidden';
containerElement.style.visibility = 'hidden';
} else {
endBeforeStart.style.display = 'none';
timeElement.style.visibility = 'visible';
containerElement.style.visibility = 'visible';
if (!timeline) {
makeTimeline(startJulian, startJulian, endJulian);
}
Expand Down Expand Up @@ -146,14 +172,38 @@ define(['dojo',
newDatesSelected();
}

// React to theme changes
//
function setThemeLight() {
document.body.className = 'claro';
dijit.byId('themeSelector').set('label', 'Theme: Light');
animation.applyThemeChanges();
}
function setThemeDark() {
document.body.className = 'claro cesium-darker';
dijit.byId('themeSelector').set('label', 'Theme: Dark');
animation.applyThemeChanges();
}
function cycleTheme() {
if (document.body.className === 'claro') {
setThemeDark();
} else {
setThemeLight();
}
}

dojo.ready(function() {
endBeforeStart = document.getElementById('endBeforeStart');
timeElement = document.getElementById('time1');
containerElement = document.getElementById('timelineAndAnimation');
dojo.connect(dijit.byId('startCal'), 'onChange', newStartDateSelected);
dojo.connect(dijit.byId('endCal'), 'onChange', newEndDateSelected);
dojo.connect(dijit.byId('startTimeSel'), 'onChange', newStartTimeSelected);
dojo.connect(dijit.byId('endTimeSel'), 'onChange', newEndTimeSelected);

dojo.connect(dijit.byId('themeSelector'), 'onClick', cycleTheme);
dojo.connect(dijit.byId('themeLight'), 'onClick', setThemeLight);
dojo.connect(dijit.byId('themeDark'), 'onClick', setThemeDark);

dijit.byId('startTimeSel').set('value', 'T00:00:00');
dijit.byId('endTimeSel').set('value', 'T24:00:00');

Expand Down
3 changes: 3 additions & 0 deletions Apps/TimelineDemo/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ require({
'dijit/form/Button',
'dijit/Calendar',
'dijit/form/TimeTextBox',
'dijit/form/ComboButton',
'dijit/Menu',
'dijit/MenuItem',
'TimelineDemo/TimelineDemo',
'dojo/domReady!'
], function(
Expand Down
Loading