Skip to content

Instantly share code, notes, and snippets.

@motionharvest
Last active August 29, 2015 14:06
Show Gist options
  • Save motionharvest/64b5eec7eb5bfbf8b5d5 to your computer and use it in GitHub Desktop.
Save motionharvest/64b5eec7eb5bfbf8b5d5 to your computer and use it in GitHub Desktop.
Hold my beer
System.$win.on('mousemove', function(e) {
nextX = e.clientX;
diff = currX - nextX;
var tmpVal = (Data.Active.shell.width * Data.Active.boxes[index].perc) * System.scale;
var valMinusDif = tmpVal - diff;
var newperc = (valMinusDif / (Data.Active.shell.width * System.scale));
var percDif = newperc - Data.Active.boxes[index].perc;
Data.Active.boxes[index].perc += percDif;
Data.Active.boxes[index + 1].perc -= percDif;
boxElements[index].update({
perc: Data.Active.boxes[index].perc,
width: System.roundInches(Data.Active.shell.width * Data.Active.boxes[index].perc)
});
boxElements[index + 1].update({
perc: Data.Active.boxes[index + 1].perc,
width: System.roundInches(Data.Active.shell.width * Data.Active.boxes[index + 1].perc)
});
renderData.render();
currX = nextX;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment