Skip to content

Commit

Permalink
Bower deps.
Browse files Browse the repository at this point in the history
  • Loading branch information
borismus committed Nov 10, 2015
1 parent d424226 commit 6f13d11
Show file tree
Hide file tree
Showing 15 changed files with 2,756 additions and 6 deletions.
139 changes: 139 additions & 0 deletions bower_components/threejs/examples/js/AnimationClipCreator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
/**
*
* Creator of typical test AnimationClips / KeyframeTracks
*
* @author Ben Houston / http://clara.io/
* @author David Sarno / http://lighthaus.us/
*/

THREE.AnimationClipCreator = function() {
};

THREE.AnimationClipCreator.CreateRotationAnimation = function( period, axis ) {

var keys = [];
keys.push( { time: 0, value: 0 } );
keys.push( { time: period, value: 360 } );

axis = axis || 'x';
var trackName = '.rotation[' + axis + ']';

var track = new THREE.NumberKeyframeTrack( trackName, keys );

var clip = new THREE.AnimationClip( 'rotate.x', 10, [ track ] );
//console.log( 'rotateClip', clip );

return clip;
};

THREE.AnimationClipCreator.CreateScaleAxisAnimation = function( period, axis ) {

var keys = [];
keys.push( { time: 0, value: 0 } );
keys.push( { time: period, value: 360 } );

axis = axis || 'x';
var trackName = '.scale[' + axis + ']';

var track = new THREE.NumberKeyframeTrack( trackName, keys );

var clip = new THREE.AnimationClip( 'scale.x', 10, [ track ] );
//console.log( 'scaleClip', clip );

return clip;
};

THREE.AnimationClipCreator.CreateShakeAnimation = function( duration, shakeScale ) {

var keys = [];

for( var i = 0; i < duration * 10; i ++ ) {

keys.push( {
time: ( i / 10.0 ),
value: new THREE.Vector3( Math.random() * 2.0 - 1.0, Math.random() * 2.0 - 1.0, Math.random() * 2.0 - 1.0 ).multiply( shakeScale )
} );

}

var trackName = '.position';

var track = new THREE.VectorKeyframeTrack( trackName, keys );

var clip = new THREE.AnimationClip( 'shake' + duration, duration, [ track ] );
//console.log( 'shakeClip', clip );

return clip;
};


THREE.AnimationClipCreator.CreatePulsationAnimation = function( duration, pulseScale ) {

var keys = [];

for( var i = 0; i < duration * 10; i ++ ) {

var scaleFactor = Math.random() * pulseScale;
keys.push( {
time: ( i / 10.0 ),
value: new THREE.Vector3( scaleFactor, scaleFactor, scaleFactor )
} );

}

var trackName = '.scale';

var track = new THREE.VectorKeyframeTrack( trackName, keys );

var clip = new THREE.AnimationClip( 'scale' + duration, duration, [ track ] );
//console.log( 'scaleClip', clip );

return clip;
};


THREE.AnimationClipCreator.CreateVisibilityAnimation = function( duration ) {

var keys = [];
keys.push( {
time: 0,
value: true
} );
keys.push( {
time: duration - 1,
value: false
} );
keys.push( {
time: duration,
value: true
} );

var trackName = '.visible';

var track = new THREE.BooleanKeyframeTrack( trackName, keys );

var clip = new THREE.AnimationClip( 'visible' + duration, duration, [ track ] );
//console.log( 'scaleClip', clip );

return clip;
};


THREE.AnimationClipCreator.CreateMaterialColorAnimation = function( duration, colors, loop ) {

var timeStep = duration / colors.length;
var keys = [];
for( var i = 0; i <= colors.length; i ++ ) {
keys.push( { time: i * timeStep, value: colors[ i % colors.length ] } );
}

var trackName = '.material[0].color';

var track = new THREE.ColorKeyframeTrack( trackName, keys );

var clip = new THREE.AnimationClip( 'colorDiffuse', 10, [ track ] );
//console.log( 'diffuseClip', clip );

return clip;
};

70 changes: 70 additions & 0 deletions bower_components/threejs/examples/js/MorphAnimMesh.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/**
* @author alteredq / http://alteredqualia.com/
*/

THREE.MorphAnimMesh = function ( geometry, material ) {

THREE.Mesh.call( this, geometry, material );

this.type = 'MorphAnimMesh';

this.mixer = new THREE.AnimationMixer( this );
this.activeAction = null;
};

THREE.MorphAnimMesh.prototype = Object.create( THREE.Mesh.prototype );
THREE.MorphAnimMesh.prototype.constructor = THREE.MorphAnimMesh;

THREE.MorphAnimMesh.prototype.setDirectionForward = function () {

this.mixer.timeScale = 1.0;

};

THREE.MorphAnimMesh.prototype.setDirectionBackward = function () {

this.mixer.timeScale = -1.0;

};

THREE.MorphAnimMesh.prototype.playAnimation = function ( label, fps ) {

if( this.activeAction ) {

this.mixer.removeAction( this.activeAction );
this.activeAction = null;

}

var clip = THREE.AnimationClip.findByName( this.geometry.animations, label );

if ( clip ) {

var action = new THREE.AnimationAction( clip );
action.timeScale = ( clip.tracks.length * fps ) / clip.duration;
this.mixer.addAction( action );
this.activeAction = action;

} else {

throw new Error( 'THREE.MorphAnimMesh: animations[' + label + '] undefined in .playAnimation()' );

}

};

THREE.MorphAnimMesh.prototype.updateAnimation = function ( delta ) {

this.mixer.update( delta );

};

THREE.MorphAnimMesh.prototype.copy = function ( source ) {

THREE.Mesh.prototype.copy.call( this, source );

this.mixer = new THREE.AnimationMixer( this );

return this;

};
73 changes: 73 additions & 0 deletions bower_components/threejs/examples/js/MorphAnimation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/**
* @author mrdoob / http://mrdoob.com
* @author willy-vvu / http://willy-vvu.github.io
*/

THREE.MorphAnimation = function ( mesh ) {

this.mesh = mesh;
this.frames = mesh.morphTargetInfluences.length;
this.currentTime = 0;
this.duration = 1000;
this.loop = true;
this.lastFrame = 0;
this.currentFrame = 0;

this.isPlaying = false;

};

THREE.MorphAnimation.prototype = {

constructor: THREE.MorphAnimation,

play: function () {

this.isPlaying = true;

},

pause: function () {

this.isPlaying = false;

},

update: function ( delta ) {

if ( this.isPlaying === false ) return;

this.currentTime += delta;

if ( this.loop === true && this.currentTime > this.duration ) {

this.currentTime %= this.duration;

}

this.currentTime = Math.min( this.currentTime, this.duration );

var frameTime = this.duration / this.frames;
var frame = Math.floor( this.currentTime / frameTime );

var influences = this.mesh.morphTargetInfluences;

if ( frame !== this.currentFrame ) {

influences[ this.lastFrame ] = 0;
influences[ this.currentFrame ] = 1;
influences[ frame ] = 0;

this.lastFrame = this.currentFrame;
this.currentFrame = frame;

}

var mix = ( this.currentTime % frameTime ) / frameTime;

influences[ frame ] = mix;
influences[ this.lastFrame ] = 1 - mix;

}

};
62 changes: 62 additions & 0 deletions bower_components/threejs/examples/js/geometries/TextGeometry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
* @author zz85 / http://www.lab4games.net/zz85/blog
* @author alteredq / http://alteredqualia.com/
*
* For creating 3D text geometry in three.js
*
* Text = 3D Text
*
* parameters = {
* size: <float>, // size of the text
* height: <float>, // thickness to extrude text
* curveSegments: <int>, // number of points on the curves
*
* font: <string>, // font name
* weight: <string>, // font weight (normal, bold)
* style: <string>, // font style (normal, italics)
*
* bevelEnabled: <bool>, // turn on bevel
* bevelThickness: <float>, // how deep into text bevel goes
* bevelSize: <float>, // how far from text outline is bevel
* }
*
*/

/* Usage Examples
// TextGeometry wrapper
var text3d = new TextGeometry( text, options );
// Complete manner
var textShapes = THREE.FontUtils.generateShapes( text, options );
var text3d = new ExtrudeGeometry( textShapes, options );
*/


THREE.TextGeometry = function ( text, parameters ) {

parameters = parameters || {};

var textShapes = THREE.FontUtils.generateShapes( text, parameters );

// translate parameters to ExtrudeGeometry API

parameters.amount = parameters.height !== undefined ? parameters.height : 50;

// defaults

if ( parameters.bevelThickness === undefined ) parameters.bevelThickness = 10;
if ( parameters.bevelSize === undefined ) parameters.bevelSize = 8;
if ( parameters.bevelEnabled === undefined ) parameters.bevelEnabled = false;

THREE.ExtrudeGeometry.call( this, textShapes, parameters );

this.type = 'TextGeometry';

};

THREE.TextGeometry.prototype = Object.create( THREE.ExtrudeGeometry.prototype );
THREE.TextGeometry.prototype.constructor = THREE.TextGeometry;
14 changes: 14 additions & 0 deletions bower_components/threejs/examples/js/libs/jszip.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 6f13d11

Please sign in to comment.