Mercurial > code > home > repos > light9
changeset 1364:b7023c28dd4f
rm demo adjusters. build first real adjuster on originTime of note
Ignore-this: 22f1b870b3f742aa5dc47d9427ba3847
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Mon, 06 Jun 2016 06:45:01 +0000 |
parents | 233b81d9bd9d |
children | a6ca5e87ab3e |
files | light9/web/timeline-elements.html light9/web/timeline.coffee show/dance2016/song1.n3 |
diffstat | 3 files changed, 35 insertions(+), 59 deletions(-) [+] |
line wrap: on
line diff
--- a/light9/web/timeline-elements.html Mon Jun 06 05:57:30 2016 +0000 +++ b/light9/web/timeline-elements.html Mon Jun 06 06:45:01 2016 +0000 @@ -56,7 +56,10 @@ <light9-timeline-diagram-layer id="dia"></light9-timeline-diagram-layer> <light9-timeline-adjusters id="adjusters" dia="{{dia}}" - adjs="{{adjs}}"> + graph="{{graph}}" + song="{{song}}" + parent-adjs="{{adjs}}" + zoom-in-x="{{zoomInX}}"> </light9-timeline-adjusters> </template>
--- a/light9/web/timeline.coffee Mon Jun 06 05:57:30 2016 +0000 +++ b/light9/web/timeline.coffee Mon Jun 06 06:45:01 2016 +0000 @@ -56,7 +56,7 @@ @fullZoomX, @zoomInX, @viewState.cursor) ) - @adjs = @makeZoomAdjs().concat(@persistDemo()) + @adjs = @makeZoomAdjs() @trackMouse() @bindKeys() @@ -130,31 +130,6 @@ @animatedZoom(newCenter - visSeconds / 2, newCenter + visSeconds / 2, zoomAnimSec) - persistDemo: -> - ctx = @graph.Uri(@song) - adjs = [] - for n in [0..7] - subj = @graph.Uri(':demoResource'+n) - adjs.push(new AdjustableFloatObject({ - graph: @graph - subj: subj - pred: @graph.Uri(':startTime') - ctx: ctx - getTargetTransform: (value) => $V([@zoomInX(value), 600]) - getValueForPos: (pos) => @zoomInX.invert(pos.e(1)) - getSuggestedTargetOffset: () => $V([0, -80]) - })) - adjs.push(new AdjustableFloatObject({ - graph: @graph - subj: subj - pred: @graph.Uri(':endTime') - ctx: ctx - getTargetTransform: (value) => $V([@zoomInX(value), 600]) - getValueForPos: (pos) => @zoomInX.invert(pos.e(1)) - getSuggestedTargetOffset: () => $V([0, -80]) - })) - return adjs - makeZoomAdjs: -> yMid = @$.audio.offsetTop + @$.audio.offsetHeight / 2 dur = @viewState.zoomSpec.duration @@ -231,14 +206,12 @@ ready: -> onUri: -> - @graph.subscribe(@uri, null, null, @update.bind(@)) + @graph.runHandler(@update.bind(@)) update: -> # update our note DOM and SVG elements based on the graph U = (x) -> @graph.Uri(x) - return if !@zoomInX try - worldPts = [] # (song time, value) originTime = @graph.floatValue(@uri, U(':originTime')) @@ -264,8 +237,32 @@ Polymer is: "light9-timeline-adjusters" properties: - adjs: { type: Array }, + adjs: { type: Array }, # our computed list + parentAdjs: { type: Array }, # incoming requests + graph: { type: Object, notify: true } + song: { type: String, notify: true } + zoomInX: { type: Object, notify: true } dia: { type: Object } + observers: [ + 'update(parentAdjs, graph, song, dia)' + 'onGraph(graph, song)' + ] + onGraph: (graph, song, zoomInX) -> + graph.runHandler(@update.bind(@)) + update: (parentAdjs, graph, song, dia) -> + U = (x) -> @graph.Uri(x) + @adjs = @parentAdjs.slice() + for note in @graph.objects(@song, U(':note')) + @push('adjs', new AdjustableFloatObject({ + graph: @graph + subj: note + pred: @graph.Uri(':originTime') + ctx: @graph.Uri(@song) + getTargetTransform: (value) => $V([@zoomInX(value), 600]) + getValueForPos: (pos) => @zoomInX.invert(pos.e(1)) + getSuggestedTargetOffset: () => $V([0, -80]) + })) + updateAllCoords: -> for elem in @querySelectorAll('light9-timeline-adjuster') elem.updateDisplay()
--- a/show/dance2016/song1.n3 Mon Jun 06 05:57:30 2016 +0000 +++ b/show/dance2016/song1.n3 Mon Jun 06 06:45:01 2016 +0000 @@ -4,35 +4,11 @@ @prefix xml: <http://www.w3.org/XML/1998/namespace> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . -ns1:demoResource0 ns1:endTime 120.3 ; - ns1:startTime 3.421 . - -ns1:demoResource1 ns1:endTime 16 ; - ns1:startTime 6.791 . - -ns1:demoResource2 ns1:endTime 60 ; - ns1:startTime 38 . - -ns1:demoResource3 ns1:endTime 62.149 ; - ns1:startTime 56 . - -ns1:demoResource4 ns1:endTime 78.599 ; - ns1:startTime 73 . - -ns1:demoResource5 ns1:endTime 105 ; - ns1:startTime 87.573 . - -ns1:demoResource6 ns1:endTime 113.942 ; - ns1:startTime 109.328 . - -ns1:demoResource7 ns1:endTime 140.711 ; - ns1:startTime 130.447 . - <http://light9.bigasterisk.com/show/dance2016/song1> ns1:note <http://light9.bigasterisk.com/show/dance2016/song1/n1> . <http://light9.bigasterisk.com/show/dance2016/song1/n1> a ns1:Note ; ns1:curve <http://light9.bigasterisk.com/show/dance2016/song1/n1c1> ; - ns1:originTime 5 . + ns1:originTime 29.932 . <http://light9.bigasterisk.com/show/dance2016/song1/n1c1> a ns1:Curve ; ns1:attr ns1:strength ; @@ -44,12 +20,12 @@ <http://light9.bigasterisk.com/show/dance2016/song1/n1c1p0> ns1:time 0.00 ; ns1:value 0 . -<http://light9.bigasterisk.com/show/dance2016/song1/n1c1p1> ns1:time 0.02 ; +<http://light9.bigasterisk.com/show/dance2016/song1/n1c1p1> ns1:time 12.08 ; ns1:value 1 . -<http://light9.bigasterisk.com/show/dance2016/song1/n1c1p2> ns1:time 0.10 ; +<http://light9.bigasterisk.com/show/dance2016/song1/n1c1p2> ns1:time 15.10 ; ns1:value 1 . -<http://light9.bigasterisk.com/show/dance2016/song1/n1c1p3> ns1:time 0.65 ; +<http://light9.bigasterisk.com/show/dance2016/song1/n1c1p3> ns1:time 23.65 ; ns1:value 0 .