├── start-on-mac.sh ├── img ├── flow │ ├── click-header.png │ ├── click-share.png │ ├── click-users.png │ ├── google-sheets.png │ ├── click-count-by.png │ ├── click-table-tab.png │ └── click-google-sheets.png └── screenshot-trevor-demo.png ├── index.html ├── css └── index.css ├── README.md ├── LICENSE └── js └── index.js /start-on-mac.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | open http://localhost:8000 4 | python -m SimpleHTTPServer 8000 5 | -------------------------------------------------------------------------------- /img/flow/click-header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tagspace/trevor-demo/HEAD/img/flow/click-header.png -------------------------------------------------------------------------------- /img/flow/click-share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tagspace/trevor-demo/HEAD/img/flow/click-share.png -------------------------------------------------------------------------------- /img/flow/click-users.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tagspace/trevor-demo/HEAD/img/flow/click-users.png -------------------------------------------------------------------------------- /img/flow/google-sheets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tagspace/trevor-demo/HEAD/img/flow/google-sheets.png -------------------------------------------------------------------------------- /img/flow/click-count-by.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tagspace/trevor-demo/HEAD/img/flow/click-count-by.png -------------------------------------------------------------------------------- /img/flow/click-table-tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tagspace/trevor-demo/HEAD/img/flow/click-table-tab.png -------------------------------------------------------------------------------- /img/screenshot-trevor-demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tagspace/trevor-demo/HEAD/img/screenshot-trevor-demo.png -------------------------------------------------------------------------------- /img/flow/click-google-sheets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tagspace/trevor-demo/HEAD/img/flow/click-google-sheets.png -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
10 |
11 |
this is a label
12 |
13 | 14 |
15 |
16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /css/index.css: -------------------------------------------------------------------------------- 1 | .demo-container img { 2 | width: 100%; 3 | } 4 | 5 | .circle { 6 | border: solid 4px #d87070; 7 | cursor: pointer; 8 | position: absolute; 9 | } 10 | 11 | .demo-container { 12 | position: relative; 13 | overflow: hidden; 14 | } 15 | 16 | .circle-label { 17 | /* position relative to its ancestor (the circle) */ 18 | position: absolute; 19 | 20 | /* provide some visual styling */ 21 | text-align: center; 22 | font-weight: 600; 23 | background-color: #222; 24 | color: #fff; 25 | padding: 10px; 26 | width: 135px; 27 | border-radius: 5px; 28 | } 29 | 30 | .image-holder { 31 | position: relative; 32 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Code for: "interactive demo" from Trevor.io landing page 2 | 3 | We built an interactive demo walk-through of our platform for our landing page (click image below to [see it in action](https://trevor.io#demo)). 4 | 5 | Feel free to fork this repo if you want to **build your own** interactive demo. 6 | 7 | [![screenshot trevor demo](https://raw.githubusercontent.com/tagspace/trevor-demo/master/img/screenshot-trevor-demo.png)](https://trevor.io#demo) 8 | 9 | A blogpost explaining how we built it is available [here](https://app.trevor.io/public/blog/demo). 10 | 11 | To run this demo on your own machine, clone/download this repo and run: 12 | 13 | ./start-on-mac.sh 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 tagspace 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /js/index.js: -------------------------------------------------------------------------------- 1 | var steps = [ 2 | ['/img/flow/click-users.png', [1, 280], 'Start by choosing the database table you want to view', true], 3 | ['/img/flow/click-header.png', [765, 155], 'Click a column header to start building your query', true], 4 | ['/img/flow/click-count-by.png', [777, 257], "Let's GROUP users BY country", false], 5 | ['/img/flow/click-table-tab.png', [572, 202], 'You can see the results as a chart or a data table', true], 6 | ['/img/flow/click-share.png', [722, 149], "Let's export these results", false], 7 | ['/img/flow/click-google-sheets.png', [773, 266], 'Live-stream the results into Google Sheets', false], 8 | ['/img/flow/google-sheets.png', [54, -14], 'Back to Trevor', true], 9 | ]; 10 | 11 | var step = 0; 12 | 13 | function adjusted(length) { 14 | var originalHeight = 785; 15 | var currentHeight = $('.screenshot').height(); 16 | var ratio = currentHeight / originalHeight; 17 | return length * ratio; 18 | } 19 | 20 | function getRadius() { 21 | return adjusted(40); 22 | } 23 | 24 | function animateCircle(circleRadius, ms, animateLabel, cb) { 25 | var radius = getRadius(); 26 | var coordinates = steps[step][1]; 27 | $('.circle') 28 | .animate({ 29 | top: adjusted(coordinates[1]) - (circleRadius - radius), 30 | left: adjusted(coordinates[0]) - (circleRadius - radius), 31 | width: circleRadius * 2, 32 | height: circleRadius * 2, 33 | borderTopLeftRadius: circleRadius, 34 | borderTopRightRadius: circleRadius, 35 | borderBottomLeftRadius: circleRadius, 36 | borderBottomRightRadius: circleRadius 37 | }, { 38 | complete: cb, 39 | duration: ms, 40 | step: function() { 41 | //jquery.animate sets overflow: hidden during animation, so need to override that (otherwise label disappears) 42 | $('.circle').css("overflow","visible"); 43 | } 44 | }); 45 | var labelText = steps[step][2]; 46 | if(animateLabel) { //when the big circle shrinks, we want the label to swoop in with it 47 | $('.circle-label') 48 | .text(labelText) 49 | .animate({ 50 | top: radius * 1.8 + (circleRadius - radius), 51 | left: radius * 1.8 + (circleRadius - radius) 52 | }, { 53 | duration: ms 54 | }); 55 | } 56 | } 57 | 58 | var containerWidth = $('.demo-container').width(); 59 | var isMobile = containerWidth <= 480; 60 | 61 | if(isMobile) { 62 | //to stop vertical overflow 63 | $('.demo-container').css({ 64 | height: 400 65 | }) 66 | } 67 | 68 | function updateCircle() { 69 | stopPulsate(); 70 | //hide the circle 71 | $('.circle').hide(); 72 | 73 | //calculate end position of zoom 74 | var coordinates = steps[step][1]; 75 | var left = -1 * adjusted(coordinates[0]) + (containerWidth/2) - getRadius(); 76 | if(left > 0) { 77 | left = 0; 78 | } 79 | 80 | //zoom out 81 | var zoomOut = steps[step][3]; 82 | $('.image-holder').animate((!isMobile || !zoomOut ? {} : { //only zoom out if step requires it 83 | width: containerWidth, 84 | left: 0, 85 | top: 0 86 | }), 1000, function() { 87 | //change image 88 | var image = steps[step][0]; 89 | $('.screenshot').attr('src', image); 90 | //zoom in 91 | $('.image-holder').animate((!isMobile ? {} : { 92 | width: containerWidth*2, 93 | left: left 94 | }), 2000, function() { 95 | $('.circle').show();//show the circle again 96 | var radius = getRadius(); 97 | animateCircle(adjusted(2000), 0, false, function() { 98 | animateCircle(radius, 750, true, function() { 99 | startPulsate(); 100 | }) 101 | }) 102 | }); 103 | }); 104 | } 105 | 106 | var interval = null; 107 | 108 | function startPulsate() { 109 | interval = setInterval(function() { 110 | var radius = getRadius(); 111 | animateCircle(radius+adjusted(20), 200, true, function() { 112 | animateCircle(radius, 200, true) 113 | }) 114 | }, 1500); 115 | } 116 | 117 | function stopPulsate() { 118 | $('.circle').stop();//stop any running animations 119 | clearInterval(interval); 120 | } 121 | 122 | updateCircle(); 123 | 124 | $('.circle').click(function() { 125 | step = (step + 1) % steps.length; 126 | updateCircle(); 127 | }) --------------------------------------------------------------------------------