Skip to content

Commit

Permalink
Replace react-motion with in-tree Animation/Tween components
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Oct 14, 2021
1 parent 0d82c3b commit 56479bb
Show file tree
Hide file tree
Showing 5 changed files with 357 additions and 292 deletions.
53 changes: 0 additions & 53 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Expand Up @@ -10,7 +10,6 @@
"devDependencies": {
"@babel/core": "^7.13.15",
"@babel/preset-react": "^7.13.13",
"@serprex/react-motion": "^0.6.3",
"@wasm-tool/wasm-pack-plugin": "^1.4.0",
"babel-loader": "^8.2.2",
"html-webpack-plugin": "^5.3.1",
Expand Down
44 changes: 0 additions & 44 deletions src/Components/index.js
Expand Up @@ -22,50 +22,6 @@ export function Box(props) {
);
}

export class OnDelay extends Component {
constructor(props) {
super(props);
this._timeout = 0;
}

componentDidMount() {
this._timeout = setTimeout(() => {
if (this._timeout) {
this._timeout = 0;
if (this.props.onTimeout) {
this.props.onTimeout();
}
}
}, this.props.ms);
}

componentWillUnmount() {
if (this._timeout) {
clearTimeout(this._timeout);
this._timeout = 0;
}
}

render() {
return this.props.children || null;
}
}

export class Delay extends Component {
constructor(props) {
super(props);
this.state = { on: false };
}

render() {
return (
<OnDelay ms={this.props.ms} onTimeout={() => this.setState({ on: true })}>
{this.state.on ? this.props.second : this.props.first}
</OnDelay>
);
}
}

export function CardImage(props) {
const { card } = props,
bgcol = ui.maybeLightenStr(card);
Expand Down
2 changes: 1 addition & 1 deletion src/rs/src/skill.rs
Expand Up @@ -2908,7 +2908,7 @@ impl Skill {
}) {
let inst =
ctx.new_thing(card::As(ctx.get(c, Stat::card), newcard.code as i32), owner);
ctx.fx(inst, Fx::StartPos(inst));
ctx.fx(inst, Fx::StartPos(c));
ctx.addPerm(owner, inst);
}
}
Expand Down

0 comments on commit 56479bb

Please sign in to comment.