From 24186fc504859d774ebda65d5702132098d6de97 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 26 Jun 2018 02:21:04 +0200 Subject: offsets --- app/client/modules/morph/views/morph.app.js | 32 ++++++++++++++++++----------- 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'app/client/modules/morph') diff --git a/app/client/modules/morph/views/morph.app.js b/app/client/modules/morph/views/morph.app.js index 38cd121..e1480ba 100644 --- a/app/client/modules/morph/views/morph.app.js +++ b/app/client/modules/morph/views/morph.app.js @@ -24,9 +24,14 @@ class MorphResults extends Component { a: "", b: "", a_offset: 0, + a_duration: 1, + a_pos: 0, b_offset: 0, + b_duration: 1, + b_pos: 0, steps: 16, dilate: 2, + frames: 32, smooth: true, mode: 'mix', } @@ -43,13 +48,13 @@ class MorphResults extends Component { sequence.name.split("_").slice(0, 3).join(" ") + "~ (" + sequence.count + ")", sequence.name ]) + const sequenceLookup = sequences.reduce((a,b) => (a[b.name]=b,a), {}) - console.log(sequence_options) - const totalLength = (this.state.steps * this.state.dilate) / 25 + const totalLength = this.state.frames / 25 let lengthWarning if (this.state.steps > 64) { lengthWarning = ( -
warning, this may take a while
+
warning, this will take a while
) } @@ -65,13 +70,13 @@ class MorphResults extends Component { title="Starting sequence" value={this.state.a} options={sequence_options} - onChange={key => this.setState({ a: key })} + onChange={(name, key) => this.setState({ a: key, a_duration: sequenceLookup[key].count, a_pos: 0, a_offset: 0 })} /> this.setState({ a_offset: key })} + onChange={key => this.setState({ a_pos: key, a_offset: key * (this.state.a_duration - this.state.frames) })} /> @@ -80,13 +85,13 @@ class MorphResults extends Component { title="Ending sequence" value={this.state.b} options={sequence_options} - onChange={key => this.setState({ b: key })} + onChange={(name, key) => this.setState({ b: key, b_duration: sequenceLookup[key].count, b_pos: 0, b_offset: 0 })} /> this.setState({ b_offset: key })} + onChange={key => this.setState({ b_pos: key, b_offset: key * (this.state.b_duration - this.state.frames) })} /> @@ -102,14 +107,14 @@ class MorphResults extends Component { title="Steps" value={this.state.steps} options={[2,4,8,16,32,64,128,256]} - onChange={key => this.setState({ steps: key })} + onChange={key => this.setState({ steps: key, frames: (key * this.state.dilate) })} /> this.setState({ dilate: key })} + options={[1,2,4,8,16,32]} + onChange={key => this.setState({ dilate: key, frames: (this.state.steps * key) })} /> {totalLength.toFixed(1) + " seconds"} + + {this.state.frames + " frames"} + {lengthWarning}
-- cgit v1.2.3-70-g09d2