rotations
This commit is contained in:
parent
9ffd0f868e
commit
553b065e8d
@ -67,27 +67,23 @@ class AttackCharge extends Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
let rotate = 0; // Self target value
|
||||
if (this.props.direction.y) {
|
||||
anime.set('#strike', {
|
||||
rotate: -Math.atan(this.props.direction.y / this.props.direction.x) * 180 / Math.PI,
|
||||
});
|
||||
console.log(Math.atan(this.props.direction.y / this.props.direction.x) * 180 / Math.PI);
|
||||
} else {
|
||||
anime.set('#strike', {
|
||||
rotate: 90,
|
||||
});
|
||||
if (!this.props.direction.x) rotate = this.props.direction.y > 0 ? 0 : 180;
|
||||
else {
|
||||
rotate = this.props.direction.y > 0
|
||||
? -Math.atan(this.props.direction.y / this.props.direction.x) * 180 / Math.PI
|
||||
: -Math.atan(this.props.direction.y / this.props.direction.x) * 180 / Math.PI + 180;
|
||||
}
|
||||
} else if (this.props.direction.x) {
|
||||
rotate = this.props.direction.x > 0 ? 270 : 90;
|
||||
}
|
||||
|
||||
/* if (!this.props.team) {
|
||||
anime.set('.skill-anim', {
|
||||
rotate: Math.random() * 180 + 90,
|
||||
});
|
||||
} else {
|
||||
anime.set('.skill-anim', {
|
||||
rotate: Math.random() * 180 + 270,
|
||||
});
|
||||
}
|
||||
*/ anime.set('.skill-anim', {
|
||||
anime.set('.skill-anim', {
|
||||
rotate,
|
||||
});
|
||||
|
||||
anime.set('.skill-anim', {
|
||||
translateY: -400,
|
||||
translateX: 0,
|
||||
opacity: 0,
|
||||
|
||||
@ -61,28 +61,26 @@ class Strike extends Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
console.log(this.props.direction);
|
||||
/* if (this.props.direction.y) {
|
||||
anime.set('#strike', {
|
||||
rotate: -Math.atan(this.props.direction.y / this.props.direction.x) * 180 / Math.PI,
|
||||
});
|
||||
console.log(Math.atan(this.props.direction.y / this.props.direction.x) * 180 / Math.PI);
|
||||
} else {
|
||||
anime.set('#strike', {
|
||||
rotate: 90,
|
||||
});
|
||||
}
|
||||
*/
|
||||
let rotate = 90;
|
||||
let rotate = 0; // Self target value
|
||||
if (this.props.direction.y) {
|
||||
if (!this.props.direction.x) rotate = 0;
|
||||
if (!this.props.direction.x) rotate = this.props.direction.y > 0 ? 0 : 180;
|
||||
else {
|
||||
rotate = this.props.direction.y > 0
|
||||
? -Math.atan(this.props.direction.y / this.props.direction.x) * 180 / Math.PI
|
||||
: -Math.atan(this.props.direction.y / this.props.direction.x) * 180 / Math.PI + 180;
|
||||
}
|
||||
} else if (this.props.direction.x) {
|
||||
rotate = this.props.direction.x > 0 ? 270 : 90;
|
||||
}
|
||||
anime.set('#strike', {
|
||||
translateY: -300 * this.props.direction.y,
|
||||
translateX: -150 * this.props.direction.x,
|
||||
rotate,
|
||||
});
|
||||
|
||||
anime.set('#strike', {
|
||||
translateY: -400,
|
||||
translateX: 0,
|
||||
});
|
||||
|
||||
this.animations.push(anime({
|
||||
targets: '#strike',
|
||||
opacity: [
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user