Add MilkDrop title text animation

This commit is contained in:
jberg 2018-09-30 17:57:41 -07:00 committed by Jordan Eldredge
parent 2eab287fbc
commit 9eedbe6609
3 changed files with 21 additions and 5 deletions

View File

@ -1,4 +1,6 @@
import React from "react";
import { connect } from "react-redux";
import { getCurrentTrackDisplayName } from "../../selectors";
import DropTarget from "../DropTarget";
import PresetOverlay from "./PresetOverlay";
@ -6,7 +8,7 @@ const USER_PRESET_TRANSITION_SECONDS = 5.7;
const PRESET_TRANSITION_SECONDS = 2.7;
const MILLISECONDS_BETWEEN_PRESET_TRANSITIONS = 15000;
export default class Milkdrop extends React.Component {
class Milkdrop extends React.Component {
constructor(props) {
super(props);
this.state = {
@ -64,6 +66,10 @@ export default class Milkdrop extends React.Component {
) {
this.visualizer.setRendererSize(this.props.width, this.props.height);
}
if (this.props.trackTitle !== prevProps.trackTitle) {
this.visualizer.launchSongTitleAnim(this.props.trackTitle);
}
}
_pauseViz() {
@ -108,6 +114,10 @@ export default class Milkdrop extends React.Component {
this.setState({ presetOverlay: !this.state.presetOverlay });
e.stopPropagation();
break;
case 84: // T
this.visualizer.launchSongTitleAnim(this.props.trackTitle);
e.stopPropagation();
break;
case 145: // scroll lock
case 125: // F14 (scroll lock for OS X)
this.presetCycle = !this.presetCycle;
@ -232,3 +242,9 @@ export default class Milkdrop extends React.Component {
);
}
}
const mapStateToProps = state => ({
trackTitle: getCurrentTrackDisplayName(state)
});
export default connect(mapStateToProps)(Milkdrop);

View File

@ -71,7 +71,7 @@
"babel-jest": "^23.4.2",
"babel-loader": "^8.0.0-beta.6",
"babel-plugin-remove-webpack": "^1.1.0",
"butterchurn": "^2.4.10",
"butterchurn": "^2.5.3",
"butterchurn-presets": "^2.4.7",
"canvas-mock": "0.0.0",
"cardinal-spline-js": "^2.3.9",

View File

@ -1596,9 +1596,9 @@ butterchurn-presets@^2.4.7:
ecma-proposal-math-extensions "0.0.2"
lodash "^4.17.4"
butterchurn@^2.4.10:
version "2.4.10"
resolved "https://registry.yarnpkg.com/butterchurn/-/butterchurn-2.4.10.tgz#bf74ed57629a73063f4726e1ddeabb8bc9276ff1"
butterchurn@^2.5.3:
version "2.5.3"
resolved "https://registry.yarnpkg.com/butterchurn/-/butterchurn-2.5.3.tgz#e654aff4031921003323e1741569af7a24bc4102"
dependencies:
babel-runtime "^6.26.0"
ecma-proposal-math-extensions "0.0.2"