Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Component } from 'react';
- import * as THREE from 'three';
- import React3 from 'react-three-renderer';
- import logo from './logo.svg';
- import './App.css';
- const meshScale = new THREE.Vector3(1,1,1).multiplyScalar(0.5;
- )
- export default class Shape extends Component {
- constructor(props, context) {
- super(props, context);
- this.state = {
- ...this.state,
- timer: Date.now() * 0.0001,
- scene: {},
- };
- this.objectPositions = [
- new THREE.Vector3(-400, 0, 200),
- ];
- }
- render() {
- const {
- timer,
- } = this.state;
- const objectRotation = new THREE.Euler(
- timer * 5,
- timer * 2.5,
- 0,
- );
- return (
- <mesh
- position={this.objectPositions[0]}
- rotation={objectRotation}
- scale={meshScale}
- castShadow
- >
- <icosahedronGeometry
- radius={75}
- detail={1}
- />
- <geometryResource
- resourceId='cubeGeo'
- />
- <materialResource
- resourceId="cubeMaterial"
- />
- </mesh>
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement