|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
window.makeGS = function(){ |
|
var gs = {} |
|
|
|
var bodySel = d3.select('body') |
|
|
|
var prevSlideIndex = -1 |
|
function updateSlide(i){ |
|
var slide = slides[i] |
|
if (!slide) return |
|
|
|
gs.prevSlide = gs.curSlide |
|
gs.curSlide = slide |
|
|
|
var dur = gs.prevSlide ? 500*1 : 0 |
|
|
|
sel.personSel.transition().duration(dur) |
|
.translate(d => d.pos[slide.pos]) |
|
|
|
sel.textSel.transition().duration(dur) |
|
.at({fill: slide.textFill}) |
|
|
|
|
|
sel.rectSel.transition('opacity').duration(dur) |
|
.at({opacity: slide.rectOpacity}) |
|
|
|
if (!slide.animateThreshold){ |
|
sel.rectSel.transition('fill').duration(dur) |
|
.at({fill: slide.rectFill}) |
|
|
|
sel.textSel.transition('stroke').duration(dur) |
|
.st({strokeWidth: slide.textStroke}) |
|
|
|
slider.setSlider(slide.threshold, true) |
|
bodySel.transition('gs-tween') |
|
} else { |
|
sel.rectSel.transition('fill').duration(dur) |
|
sel.textSel.transition('stroke').duration(dur) |
|
|
|
bodySel.transition('gs-tween').duration(dur*2) |
|
.attrTween('gs-tween', () => { |
|
var i = d3.interpolate(slider.threshold, slide.threshold) |
|
|
|
return t => { |
|
slider.setSlider(i(t)) |
|
} |
|
}) |
|
} |
|
|
|
|
|
sel.truthAxis.transition().duration(dur) |
|
.st({opacity: slide.truthAxisOpacity}) |
|
|
|
sel.mlAxis.transition().duration(dur) |
|
.st({opacity: slide.mlAxisOpacity}) |
|
|
|
sel.fpAxis.transition().duration(dur) |
|
.st({opacity: slide.fpAxisOpacity}) |
|
|
|
sel.sexAxis.transition().duration(dur) |
|
.st({opacity: slide.sexAxisOpacity}) |
|
|
|
sel.brAxis.transition().duration(dur) |
|
.st({opacity: slide.brAxisOpacity}) |
|
|
|
sel.botAxis.transition().duration(dur) |
|
.translate(slide.botAxisY, 1) |
|
|
|
|
|
prevSlideIndex = i |
|
slides.curSlide = slide |
|
} |
|
|
|
gs.graphScroll = d3.graphScroll() |
|
.container(d3.select('.container-1')) |
|
.graph(d3.selectAll('container-1 #graph')) |
|
.eventId('uniqueId1') |
|
.sections(d3.selectAll('.container-1 #sections > div')) |
|
.offset(innerWidth < 900 ? 300 : 520) |
|
.on('active', updateSlide) |
|
|
|
return gs |
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (window.init) window.init() |
|
|