Examples of four three.js

1, Videos 100 color gradient of a straight line, these straight lines starting coordinates (0, 0, 0,), end point coordinates uniformly distributed radius of the circle 500 (the circle on yoz plane), the starting and ending color from definition. Tip: This is a straight line for 100 cycles achieved.

The main experimental parameters opening code is as follows:

function initObject() {

 var geometry = new THREE.Geometry();

        var material = new THREE.LineBasicMaterial( { vertexColors: true } );

var color1 = new THREE.Color (0xff00ff); // color origin

 color2 =   new THREE.Color( 0x00ffff )  ; 

for(i=0;i<   100    ;i++)

{

                p1 = new THREE.Vector3 (0,0,0); // start point coordinates

p2 = new THREE.Vector3( 0, 500*Math.cos(2*Math.PI*(i/100)), 500*Math.sin(2*Math.PI*(i/100) );//终点坐标

                geometry.vertices.push(p1);

Guess you like

Origin blog.csdn.net/qq_44762986/article/details/104663011