SHARE
TWEET

Untitled

a guest Jul 17th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { Component } from 'react';
  2. import * as THREE from 'three';
  3. import React3 from 'react-three-renderer';
  4. import logo from './logo.svg';
  5. import './App.css';
  6.  
  7. const meshScale = new THREE.Vector3(1,1,1).multiplyScalar(0.5;
  8. )
  9. export default class Shape extends Component {
  10.   constructor(props, context) {
  11.     super(props, context);
  12.     this.state = {
  13.       ...this.state,
  14.       timer: Date.now() * 0.0001,
  15.       scene: {},
  16.     };
  17.  
  18.     this.objectPositions = [
  19.       new THREE.Vector3(-400, 0, 200),        
  20.     ];
  21.  
  22.   }
  23.  
  24.    render() {
  25.        const {
  26.            timer,
  27.        } = this.state;
  28.  
  29.        const objectRotation = new THREE.Euler(
  30.            timer * 5,
  31.            timer * 2.5,
  32.            0,
  33.        );
  34.  
  35.        return (
  36.            <mesh
  37.                position={this.objectPositions[0]}
  38.                rotation={objectRotation}
  39.                scale={meshScale}
  40.  
  41.                castShadow
  42.            >
  43.                <icosahedronGeometry
  44.                    radius={75}
  45.                    detail={1}
  46.                />
  47.                <geometryResource
  48.                    resourceId='cubeGeo'
  49.                    />
  50.                <materialResource
  51.                    resourceId="cubeMaterial"
  52.                />
  53.            </mesh>
  54.        );
  55.    }
  56. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top