This repository has been archived on 2022-12-05. You can view files and clone it, but cannot push or open issues or pull requests.
GeometryDash3D/js/Plane.js

32 lines
828 B
JavaScript
Raw Normal View History

2022-11-22 10:40:56 +01:00
import { Element } from "./Element.js";
import { textureGradient } from "./utils.js";
export class Plane extends Element {
constructor(width, height, color1, color2) {
super();
const Tcolor1 = new THREE.Color(color1);
const Tcolor2 = new THREE.Color(color2);
this.data = new THREE.Mesh(
new THREE.PlaneGeometry(width, height),
new THREE.MeshPhongMaterial({
2022-11-22 10:40:56 +01:00
color: color1,
side: THREE.DoubleSide,
map: textureGradient(
width,
height,
Tcolor1.getStyle(),
Tcolor2.getStyle()
),
})
);
this.data.rotation.x = this.gameRotation;
// Shadows
this.data.receiveShadow = true;
2022-11-22 10:40:56 +01:00
}
}