Spaces:
Running
Running
File size: 4,415 Bytes
7341022 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
window.drawSlides = function(){
var slides = [
{
id: 'intro',
visible_threshold: 0, //Also sets pointerEvents
visible_tmessage: 0,
visible_calibration: 0,
constant_model_score: 0,
},
{
id: 'thresholding',
visible_threshold: 1,
visible_tmessage: 0,
visible_calibration: 0,
constant_model_score: 0,
// target_thresholds: [0, 0.25, 0.35, 0.6, 0.7, 1]
target_threshold: .4
},
{
id: 'adjustable_thresholding',
visible_threshold: 1,
visible_tmessage: 1,
visible_calibration: 0,
constant_model_score: 0,
target_threshold: .47
// target_thresholds: [0, 0.25, 0.35, 0.6, 0.7, 1]
},
{
id: 'calibration',
visible_threshold: 0,
visible_tmessage: 0,
visible_calibration: 1,
constant_model_score: 0,
target_thresholds: [0, 0.2, 0.4, 0.6, 0.8, 1]
},
{
id: 'adjusting_calibration',
visible_threshold: 0,
visible_tmessage: 0,
visible_calibration: 1,
constant_model_score: 0,
target_thresholds: [0, 0.15, 0.45, 0.55, 0.83, 1]
},
// {
// id: 'improving_calibration',
// visible_threshold: 0,
// visible_calibration: 1,
// constant_model_score: 1,
// target_thresholds: [0, 0.305, 0.407, 0.503, 0.649, 1],
// },
{
id: 'shifting_data',
visible_threshold: 0,
visible_tmessage: 0,
visible_calibration: 1,
constant_model_score: 1,
filter_rain: true
},
{
id: 'beyond_calibration',
visible_threshold: 0,
visible_tmessage: 0,
visible_calibration: 1,
constant_model_score: 1,
target_thresholds: [0, .02, .04, .96, .98, 1],
},
]
var prevSlide = null;
var gs = d3.graphScroll()
.container(d3.select('#container'))
.graph(d3.selectAll('#container #graph'))
.eventId('uniqueId1') // namespace for scroll and resize events
.sections(d3.selectAll('#container #sections > div'))
.offset(window.isMobile ? 300 : 200)
.on('active', function(i){
try{
var slide = slides.slide = slides[i]
if (!slide) return console.log(`missing slide ${i}`)
// if(slide.id != 'slide1'){
// weatherGraph.prediction_sel.at({opacity:0});
// }
// if(slide.constant_model_score){
// weatherGraph.icon_sel.transition().duration(500)
// .at({y: constant_score})
// }
// else {
// weatherGraph.icon_sel.transition().duration(500)
// .at({y: d => c.y(d.h)})
// }
//weatherGraph.threshold_sel.classed('temp')
var transition_duration = prevSlide ? 500 : 0;
// Animate threshold and thresholds between slides
var durationScale = 1
if (prevSlide){
durationScale = prevSlide.visible_calibration == slide.visible_calibration ? 1 : 3
}
if (slide.target_thresholds){
weatherGraph.setThresholds(slide.target_thresholds, transition_duration*durationScale)
}
if (slide.target_threshold){
weatherGraph.setThreshold(slide.target_threshold, transition_duration*durationScale)
}
calibrationCurve.renderBuckets()
weatherGraph.thresholdSel
.st({pointerEvents: slide.visible_threshold ? 'all' : 'none'})
.transition().duration(transition_duration)
.st({opacity: slide.visible_threshold});
weatherGraph.messageSel
.transition().duration(transition_duration)
.st({opacity: slide.visible_tmessage});
weatherGraph.predictionSel
.transition().duration(transition_duration)
.at({strokeOpacity: slide.visible_threshold ? 1: 0});
weatherGraph.weatherGroupSel
.transition().duration(transition_duration)
.ease(d3.easeBounce).delay((d, i) => Math.random()*transition_duration)
.st({opacity: d => slide.filter_rain && d.is_filter ? 0 : 1})
weatherGraph.thresholdsGroupSel
.st({pointerEvents: slide.visible_calibration ? 'all' : 'none'})
.transition().duration(transition_duration)
.st({opacity: slide.visible_calibration})
calibrationCurve.c.svg
.transition().duration(transition_duration)
.st({opacity: slide.visible_calibration})
prevSlide = slide;
} catch (e){
console.log(e)
}
})
return slides
}
if (window.init) window.init()
/*
*/ |