Skip to content

Commit

Permalink
Now with play and pause buttons and favicons
Browse files Browse the repository at this point in the history
  • Loading branch information
tmostak committed Sep 16, 2013
1 parent 660f905 commit 8fd928e
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 22 deletions.
28 changes: 19 additions & 9 deletions css/map.css
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,15 @@ div#numTokensText {
}

.anim-input {
webkit-box-shadow: 0 0 2px rgba(255,255,255,.25);
box-shadow: 0 0 2px rgba(255,255,255,.25);
//webkit-box-shadow: 0 0 2px rgba(50,50,50,.25);
//box-shadow: 0 0 2px rgba(100,100,100,.25);
position:relative;
border: none!important;
margin-bottom: 12px;
margin: 3px 8px 3px 3px;
//border-radius: 3px;
//-webkit-background-clip: padding;
background-size: cover;
padding:0px;
//padding:5px;
}

.social-button {
Expand All @@ -297,16 +300,23 @@ div#numTokensText {
padding:0px;
}

#play-icon {
.play-icon {
//border: none!important;
background: url('../img/play_green.png') no-repeat center center;
width:60px;
height:30px;
}

.pause-icon {
border: none!important;
background: url('../img/play.png') no-repeat center center;
background: url('../img/pause_blue.png') no-repeat center center;
width:60px;
height:30px;
}

#pause-icon {
border: none!important;
background: url('../img/pause.png') no-repeat center center;
.stop-icon {
//border: none!important;
background: url('../img/stop_pink.png') no-repeat center center;
width:60px;
height:30px;
}
Expand Down
Binary file added img/favicons/d_hyper_webtab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/favicons/heat_d_webtab2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file renamed img/play.png → img/play_green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/stop_pink.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 10 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>map</title>
<head profile="http://www.w3.org/2005/10/profile">
<link rel="icon"
type="image/png"
href="img/favicons/d_hyper_webtab.png">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Tweetmap</title>
<link rel="stylesheet" href="css/map.css" />
<link rel="stylesheet" href="css/chart.css" />
<link rel="stylesheet" href="lib/js/jQCloud/jqcloud/jqcloud.css">
Expand Down Expand Up @@ -43,10 +46,10 @@

</form>
<div id="animControls">
<button id="play" class="anim-input" type="button" title="Play">
<div id="play-icon"></div>
<button id="pause" class="anim-input" type="button" title="Pause">
<div id="pause-icon"></div>
<button id="play-pause" class="anim-input play-icon" type="button" title="Play/Pause">
<!--<div id="play-icon"></div>-->
<button id="stop" class="anim-input stop-icon" type="button" title="Stop">
<!--<div id="stop-icon"></div>-->
</div>
<div id="social">
<button id="twitter" class="social-button" type="button" title="Twitter">
Expand Down
2 changes: 1 addition & 1 deletion js/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function init()
HeatMap.init(heatLayer);
Search.init(map, $('form#search'), $('input#termsInput'), $('input#userInput'), $('input#locationInput'));
Settings.init(pointLayer, heatLayer, $('button#pointButton'), $('button#heatButton'));
Animation.init(pointLayer, heatLayer, $('button#play'), $('button#pause'));
Animation.init(pointLayer, heatLayer, $('button#play-pause'), $('button#stop'));
//Settings.init($('button#gridSmall'), $('button#gridMedium'), $('button#gridLarge'));
Chart.init($('div#chart'));
MapD.start();
Expand Down
18 changes: 13 additions & 5 deletions js/mapd.js
Original file line number Diff line number Diff line change
Expand Up @@ -894,23 +894,23 @@ var Animation = {
heatLayer: null,
//pointMap: null,
//heatMap: null,
playButton: null,
playPauseButton: null,
stopButton: null,
playing: false,
numFrames: 60.0,
numFrames: 20.0,
animStart: null,
animEnd: null,
step: null,
numLayersLoaded: 0,

init: function(pointLayer, heatLayer, playButton, stopButton) {
init: function(pointLayer, heatLayer, playPauseButton, stopButton) {
this.pointLayer = pointLayer;
this.heatLayer = heatLayer;
this.pointLayer.events.register("loadend", this, this.layerLoadEnd);
this.heatLayer.events.register("loadend", this, this.layerLoadEnd);
this.playButton = playButton;
this.playPauseButton = playPauseButton;
this.stopButton = stopButton;
$(this.playButton).click($.proxy(this.playFunc, this));
$(this.playPauseButton).click($.proxy(this.playFunc, this));
$(this.stopButton).click($.proxy(this.stopFunc, this));
},

Expand Down Expand Up @@ -946,6 +946,7 @@ var Animation = {
console.log("play");
if (this.playing == false) {
this.playing = true;
this.playPauseButton.removeClass("play-icon").addClass("pause-icon");
if (this.animStart == null) { // won't trigger if paused
this.animStart = this.mapd.timestart;
this.animEnd = this.mapd.timeend;
Expand All @@ -954,6 +955,11 @@ var Animation = {
this.frameEnd = this.animStart + this.step;
}
this.animFunc();

}
else {
this.playing = false;
this.playPauseButton.removeClass("pause-icon").addClass("play-icon");
}
},

Expand All @@ -964,6 +970,8 @@ var Animation = {
this.animStep = null;
this.numLayersLoaded = 0;
this.playing = false;
this.playPauseButton.removeClass("pause-icon").addClass("play-icon");
//this.playPauseButton.attr("id", "play-icon");
this.mapd.services.pointmap.reload();
this.mapd.services.heatmap.reload();
}
Expand Down

0 comments on commit 8fd928e

Please sign in to comment.