mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
fixed godrays
This commit is contained in:
parent
fca146048e
commit
505242c099
2 changed files with 6 additions and 20 deletions
|
@ -27,7 +27,7 @@ export class GodRays extends React.Component<IGodRaysProps> {
|
||||||
|
|
||||||
draw = () => {
|
draw = () => {
|
||||||
if (this.props.raised || !this.canvas) {
|
if (this.props.raised || !this.canvas) {
|
||||||
return setTimeout(() => window.requestAnimationFrame(this.draw), 1000);
|
return setTimeout(() => window.requestAnimationFrame(this.draw), 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { width, height, rays, particles } = this.state;
|
const { width, height, rays, particles } = this.state;
|
||||||
|
@ -40,12 +40,12 @@ export class GodRays extends React.Component<IGodRaysProps> {
|
||||||
|
|
||||||
rays.map(({ angle, iterator, weight, speed, pulsar, opacity }, index) => {
|
rays.map(({ angle, iterator, weight, speed, pulsar, opacity }, index) => {
|
||||||
const gradient = ctx.createLinearGradient(0, 0, 0, height * 1.3);
|
const gradient = ctx.createLinearGradient(0, 0, 0, height * 1.3);
|
||||||
gradient.addColorStop(0.2, `rgba(255, 60, 40, ${opacity * 0.1})`);
|
gradient.addColorStop(0.2, `rgba(160, 255, 60, ${opacity * 0.1})`);
|
||||||
gradient.addColorStop(1, 'rgba(255, 60, 40, 0)');
|
gradient.addColorStop(1, 'rgba(160, 255, 60, 0)');
|
||||||
|
|
||||||
const gradient2 = ctx.createLinearGradient(0, 0, 0, height * 1.3);
|
const gradient2 = ctx.createLinearGradient(0, 0, 0, height * 1.3);
|
||||||
gradient2.addColorStop(0.2, `rgba(255, 40, 100, ${opacity * 0.2})`);
|
gradient2.addColorStop(0.2, `rgba(60, 255, 200, ${opacity * 0.2})`);
|
||||||
gradient2.addColorStop(1, 'rgba(255, 40, 100, 0)');
|
gradient2.addColorStop(1, 'rgba(60, 255, 200, 0)');
|
||||||
|
|
||||||
ctx.save();
|
ctx.save();
|
||||||
ctx.translate(width / 2, -900);
|
ctx.translate(width / 2, -900);
|
||||||
|
@ -85,24 +85,9 @@ export class GodRays extends React.Component<IGodRaysProps> {
|
||||||
setTimeout(() => window.requestAnimationFrame(this.draw), 1000 / 15);
|
setTimeout(() => window.requestAnimationFrame(this.draw), 1000 / 15);
|
||||||
};
|
};
|
||||||
|
|
||||||
generateParticles = ({ width, height }) => {
|
|
||||||
const particles = [...new Array(1)].map(() => ({
|
|
||||||
// left: Math.random() * width / 2 + width / 4,
|
|
||||||
left: Math.random() * width * 0.7 + 0.15,
|
|
||||||
top: Math.random() * (height + 400) - 400,
|
|
||||||
iterator: Math.random() * 10,
|
|
||||||
speed: Math.random() * 0.2 + 0.2,
|
|
||||||
}));
|
|
||||||
|
|
||||||
this.setState({ particles });
|
|
||||||
};
|
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { innerWidth: width, innerHeight: height } = window;
|
const { innerWidth: width, innerHeight: height } = window;
|
||||||
|
|
||||||
this.setState({ width, height });
|
this.setState({ width, height });
|
||||||
// this.generateParticles({ width, height });
|
|
||||||
|
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ import * as ACTIONS from '~/redux/auth/actions';
|
||||||
import * as MODAL_ACTIONS from '~/redux/modal/actions';
|
import * as MODAL_ACTIONS from '~/redux/modal/actions';
|
||||||
import { ISocialProvider } from '~/redux/auth/types';
|
import { ISocialProvider } from '~/redux/auth/types';
|
||||||
import { Grid } from '~/components/containers/Grid';
|
import { Grid } from '~/components/containers/Grid';
|
||||||
|
import { GodRays } from '~/components/main/GodRays';
|
||||||
|
|
||||||
const mapStateToProps = selectAuthLogin;
|
const mapStateToProps = selectAuthLogin;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue