Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
68be2e8
integrating voodle
dvdmrn May 25, 2016
3e251ce
socket fun
dvdmrn May 26, 2016
9abddeb
rendered position to vis path
pbucci May 27, 2016
98e2763
added default params in vticonstore
pbucci May 30, 2016
15d1b3e
added class for params, in the middl eof it...
pbucci May 30, 2016
9d7495b
emit issues
dvdmrn May 30, 2016
4267a01
Merge branch 'pb_visualize_position' of https://github.com/dvdmrn/Cud…
dvdmrn May 30, 2016
70f5c8a
putting all parameter stuff in one spot + refactoring/abstracting
pbucci May 30, 2016
c7d8ac8
Merge pull request #1 from dvdmrn/pb_visualize_position
pbucci May 30, 2016
756ae26
Merge branch 'master' of https://github.com/dvdmrn/CuddleBitV2
dvdmrn May 30, 2016
fe5b806
adding params
dvdmrn May 30, 2016
0fb1c7c
updated gitignore
dvdmrn May 30, 2016
51cada6
not as hard to refactor amp as I thought...
pbucci May 30, 2016
be3c96e
Merge pull request #2 from dvdmrn/pb_refactor_amp
pbucci May 30, 2016
acde534
not as hard to refactor amp as I thought...
pbucci May 30, 2016
8872187
Merge pull request #3 from dvdmrn/pb_refactor_amp
pbucci May 30, 2016
c43215e
added a very simple point reducing function
pbucci May 30, 2016
c23797d
Merge pull request #4 from dvdmrn/pb_simple_simplify
pbucci May 30, 2016
73b3df7
improved simplify to only do selected kfs
pbucci May 30, 2016
c37fad1
Merge pull request #5 from dvdmrn/pb_simple_simplify
pbucci May 30, 2016
4785fa7
mid-way through x-scale, haven't got it figured yet
pbucci May 31, 2016
9d27508
added simple xscale
pbucci May 31, 2016
11cfedb
added keycode for scaling
pbucci May 31, 2016
c8693a4
Merge pull request #6 from dvdmrn/pb_simple_simplify
pbucci May 31, 2016
9ca830d
Update README.md
pbucci May 31, 2016
ae130bf
simplify doesn't kill last point
pbucci May 31, 2016
3bd3f5f
Merge pull request #7 from dvdmrn/pb_simple_simplify
pbucci May 31, 2016
3b1f76c
started abstraction templates, nothing moved over yet
pbucci May 31, 2016
db45ef3
Merge pull request #8 from dvdmrn/pb_simple_simplify
pbucci May 31, 2016
0e78502
added random noise
dvdmrn May 31, 2016
a4a7bc7
Merge pull request #9 from dvdmrn/dm_parameters
dvdmrn May 31, 2016
38327b8
changed shortcut for simplifying keyframe selection from ctrl+s to ct…
dvdmrn May 31, 2016
57c678f
readme formatting
dvdmrn May 31, 2016
b371d0a
readme formatting
dvdmrn May 31, 2016
52c8a70
added min value
dvdmrn May 31, 2016
908977d
render function
dvdmrn Jun 1, 2016
25e0d6f
package changes
pbucci Jun 1, 2016
1f3bb54
better normalize
pbucci Jun 1, 2016
b542f39
whatevs
pbucci Jun 1, 2016
5a016cd
render works now lol
dvdmrn Jun 2, 2016
874e936
you can now load a voodle
dvdmrn Jun 3, 2016
6c1c485
asdf
dvdmrn Jun 10, 2016
c24046b
UI truncated
dvdmrn Jun 20, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ build/bundle.js
node_modules
*.log
dist
package.json
todo
recordings/
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
# Macaron
Vibrotactile Icon Editor


### Fun keyboard shortcuts:

`arrow keys` : move playhead left or right.
`ctrl`+(`>`/`<`) : x-scale
`ctrl`+`/` : Divides selected keyframes in half.
`space` : play.
`backspace`/`delete` : remove selected keyframe(s)
`ctrl`+(`left`/`right`) : increment playhead


#### Changelog:

2016.05.31 : added a random noise parameter.
2016.05.31 : changed simplify shortcut from ctrl+s to ctrl+/ because ctrl+s also saves the page.
2016.05.30 : added x-scale functionality with ctrl-< and ctrl->, where selected points are scaled, and the rest are translated.
2016.05.30 : added a simplify functionality with ctrl-s, where points are decimated by half

##

Quick install:

`npm install`

`npm run deploy`

Run with:
Expand Down
85 changes: 85 additions & 0 deletions app/classes/parameters.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// Constructor
function Parameters() {
// always initialize all instance properties
// this.io = io;
// this.baz = 'baz'; // default value
this.parameters = {

position : {
valueScale:[0,1], //normalized
data : [
{ id: 1, t: 1500, value:0.5, selected:false}],
fun: function(out,paramvalue){
return paramvalue
}
},

random : {
valueScale:[0,1],
data : [
{id:2,t:1500,value:0,selected:false}],
fun: function(out,paramvalue){
return out+mapValue(Math.random(),0,1,0,paramvalue)
}
},

maxValue : {
valueScale:[0,1],
data : [
{id:3,t:1500,value:1, selected:false}],
fun: function(out,paramvalue){
if (out > paramvalue){
return paramvalue
}
else{
return out
}
}
},

minValue : {
valueScale:[0,1],
data : [
{id:3,t:1500,value:0, selected:false}],
fun: function(out,paramvalue){
if (out < paramvalue){
return paramvalue
}
else{
return out
}
}
},
}

}
// class methods
Parameters.prototype.getParameters = function() {
return this.parameters;
};
Parameters.prototype.getParameterKeyArray = function() {
return Object.keys(this.parameters);
};
Parameters.prototype.initParamsWith = function(val) {
var ret = {}
Object.keys(this.parameters).forEach(function(key){
ret[key] = val
})
return ret;
};



// export the class
module.exports = Parameters;


function mapValue(value, minIn, maxIn, minOut, maxOut){
if (value>maxIn){
value = maxIn;
}
if (value<minIn){
value = minIn;
}
return (value / (maxIn - minIn) )*(maxOut - minOut);
}
1 change: 1 addition & 0 deletions app/controlbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ var ControlBar = React.createClass({
return (
<div className="controlbar" style={divStyle}>
<div className="time-control" style={timeControlStyle}>

<a class="btn" href="#"><i onClick={this._onSkipBackwardClick} className="fa fa-step-backward" style={buttonStyle}></i></a>
<a class="btn" href="#"><i onClick={this._onPlayClick} className={iconText} style={buttonStyle}></i></a>
<a class="btn" href="#"><i onClick={this._onSkipForwardClick} className="fa fa-step-forward" style={buttonStyle}></i></a>
Expand Down
124 changes: 99 additions & 25 deletions app/editorheader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,31 @@ var UserAgreement = require('./useragreement.jsx');
var UserInstructions = require('./userinstructions.jsx');


var IO = require('./../thirdparty/socket/socket.io.js');
var socket = io();
var io = require('./../thirdparty/socket/socket.io.js');

var FileInput = require('react-file-input');

//for reset button
var VTIconStore = require('./stores/vticonstore.js');


var EditorHeader = React.createClass({



getInitialState: function(){
return{
socket:{}
}
},
emit: function(st,msg) {
this.state.socket.emit(st,msg)
},
componentDidMount: function() {
var socket = io.connect("http://localhost:3000");
this.setState({socket:socket});

},
mixins : [
Reflux.connect(AnimationStore.store, 'animation'), //emitted updates go to 'animation' key
Reflux.connect(StudyStore.store, 'study'), //emitted updates go to 'study' key
Expand All @@ -42,7 +58,10 @@ var EditorHeader = React.createClass({
displayRenderButton:true,
displayStopButton:true,
displayResetButton:true,
uploadFileID:"uploadedFile"
displayGetSetPointsButton:true,
displayLoadVoodleButton:true,
uploadFileID:"uploadedFile",
uploadVoodleFileID: "voodleFile"


}
Expand Down Expand Up @@ -70,29 +89,63 @@ var EditorHeader = React.createClass({
},

_onLoadClick : function(e) {


var uploadedFiles = document.getElementById(this.props.uploadFileID);
console.log('normal _onLoadClick uploaded file: ',uploadedFiles.files[0].name)
if (uploadedFiles.files.length > 0) {
SaveLoadStore.actions.loadMacaronFile(uploadedFiles.files[0]);

}
uploadedFiles.value = [];
},

_onTestClick : function(e) {
socket.emit('test');
this.emit('test');
},

_onRenderClick : function(e) {
socket.emit('render');
console.log("_onRenderClick called!!")
this.emit('render');
},

_onStopClick : function(e) {
socket.emit('stop_render');
this.emit('stop_render');
},

_onResetClick : function(e) {
VTIconStore.actions.reset();
},
_onGetSetPointsClick : function(e) {
this.emit('get_setPoints');
},

_onLoadSetPointsClick: function(e){

console.log('in _onLoadSetPointsClick!')
var uploadedFiles = document.getElementById(this.props.uploadVoodleFileID);
console.log('uploadedFiles: ',uploadedFiles)
if (uploadedFiles.files.length > 0) {
console.log('name of file: ',uploadedFiles.files[0].name)
this.emit('load_setPoints',uploadedFiles.files[0].name)

}
uploadedFiles.value = [];

},
_onLoadSetPointsButtonClick: function(e){
console.log('in _onLoadSetPoints~BUTTON~Click')
document.getElementById(this.props.uploadVoodleFileID).click();
},
handleChange: function(event) {
console.log('Selected file:', event.target.files[0].name);
name = event.target.files[0].name
if(name != undefined){
console.log('we are emitting!!!!')
this.emit('load_setPoints', name);

}
},
/**
* Rendering
*
Expand Down Expand Up @@ -200,28 +253,28 @@ var EditorHeader = React.createClass({
{
resetButton = (<button onClick={this._onResetClick}>Reset</button>);
}
var getSetPointsButton = <span />
if (this.props.displayGetSetPointsButton)
{
getSetPointsButton = (<button onClick={this._onGetSetPointsClick}>Render set points</button>);
}

var loadVoodleButton = <span />
if (this.props.displayLoadVoodleButton)
{


loadVoodleButton = (<span>
<input type="file" className='hidden' id={this.props.uploadVoodleFileID} onChange={this._onLoadSetPointsClick}></input>
<a class="btn header" style={buttonStyle} onClick={this._onLoadSetPointsButtonClick} ><i className="fa fa-upload"></i>Load Voodle</a>
</span>);
}

return (
// <div className="header" style={headerStyle}>
// {startButton}
// <span className="title unselectable" > Macaron </span>
// <span className="menu">
// {animationOptionDisplay}
// {interfaceModeDisplay}
// <UserInstructions />
// <UserAgreement />
// {saveButton}
// {loadButton}
// {saveButton}
// {testButton}
// {renderButton}
// {stopButton}

// </span>


// </div>

<div>



<div className="header" style={headerStyle}>

Expand All @@ -235,10 +288,31 @@ var EditorHeader = React.createClass({
{startButton}
{stopButton}
{resetButton}
{getSetPointsButton}
{loadVoodleButton}

</div>
<form>
<FileInput name="voodleInput"
accept=".csv"
placeholder="Voodle file"
className="inputClass"
onChange={this.handleChange} />
</form>
</div>

);
}

});










module.exports = EditorHeader;
Loading