This commit is contained in:
ntr
2019-07-05 15:42:37 +10:00
parent 3f974cb0fa
commit 723201b74c
14 changed files with 397 additions and 320 deletions
+27 -13
View File
@@ -31,12 +31,15 @@ class Absorb extends Component {
</feMerge>
</filter>
</defs>
<g class='blue' filter='url(#absorbFilter)'>
<path d= "
M 64 4
L 64 96
"/>
</g>
<polygon
class='blue'
points="64 68.64 8.574 100 63.446 67.68 64 4 64.554 67.68 119.426 100"
filter="url(#absorbFilter)">
</polygon>
<polygon
class='white'
points="64 68.64 8.574 100 63.446 67.68 64 4 64.554 67.68 119.426 100">
</polygon>
</svg>
);
}
@@ -51,13 +54,24 @@ class Absorb extends Component {
easing: 'easeInOutSine',
}));
anime({
targets: ['#absorb path'],
strokeDashoffset: [anime.setDashoffset, 0],
duration: 2000,
easing: 'linear',
loop: true,
});
this.animations.push(anime({
targets: ['#absorb polygon'],
points: '64 124.94732621931382 8.574 96.00354944613788 8.62269130211947 32.03166105954991 64 4 119.37730869788052 32.03166105954991 119.426 96.00354944613788',
easing: 'easeOutExpo',
delay: TIMES.TARGET_DELAY_MS,
duration: TIMES.TARGET_DURATION_MS,
}));
this.animations.push(anime({
targets: ['#absorb polygon.white'],
strokeWidth: [2, 1],
easing: 'easeInOutSine',
direction: 'alternate',
delay: TIMES.TARGET_DELAY_MS,
duration: TIMES.TARGET_DURATION_MS,
}));
}
// this is necessary because
+77
View File
@@ -0,0 +1,77 @@
const preact = require('preact');
const { Component } = require('preact');
const anime = require('animejs').default;
const { TIMES } = require('../../constants');
class Scatter extends Component {
constructor() {
super();
this.animations = [];
}
render() {
return (
<svg
class='skill-animation blue'
version="1.1"
id="scatter"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 128 128">
<defs>
<filter id="scatterFilter">
<feGaussianBlur in="SourceGraphic" stdDeviation="5" />
<feMerge>
<feMergeNode />
<feMergeNode in="SourceGraphic" />
</feMerge>
</filter>
</defs>
<g class='blue' filter='url(#scatterFilter)' stroke-width="4px" stroke-linecap="round" >
<path d= "
M 4 4
h 30
q 30 0 30 30
q 0 30 30 30
h 30
q 0 -30 -30 -30
h -60
q -30 0 -30 -30
"/>
</g>
</svg>
);
}
componentDidMount() {
this.animations.push(anime({
targets: ['#scatter'],
opacity: [
{ value: 1, delay: TIMES.TARGET_DELAY_MS, duration: 1000 },
// { value: 0, delay: TIMES.TARGET_DURATION_MS * 0.6, duration: TIMES.TARGET_DURATION_MS * 0.2 },
],
easing: 'easeInOutSine',
}));
anime({
targets: ['#scatter path'],
strokeDashoffset: [anime.setDashoffset, 0],
duration: TIMES.TARGET_DURATION_MS * 0.8,
delay: TIMES.TARGET_DELAY_MS,
easing: 'easeInOutSine',
});
}
// this is necessary because
// skipping / timing / unmounting race conditions
// can cause the animations to cut short, this will ensure the values are reset
// because preact will recycle all these components
componentWillUnmount() {
for (let i = this.animations.length - 1; i >= 0; i--) {
this.animations[i].reset();
}
}
}
module.exports = Scatter;
@@ -123,18 +123,3 @@ class Sustain extends Component {
}
module.exports = Sustain;
/* <polyline
points='128,168 80,240 176,240 128,168'
style={{ filter: 'url("#sustainFilter")' }}
/>
<polyline
points='176,240 212,216 128,96 44,216 80,240'
style={{ filter: 'url("#sustainFilter")' }}
/>
<polyline
points='212,216 248,192 128,24 8,192 44,216'
style={{ filter: 'url("#sustainFilter")' }}
/>
*/