1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- # Copyright 2012 United States Government, as represented by the Secretary of Defense, Under
- # Secretary of Defense (Personnel & Readiness).
- #
- # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- # in compliance with the License. You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software distributed under the License
- # is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- # or implied. See the License for the specific language governing permissions and limitations under
- # the License.
- ## Cesium base 3d object component
- ##
- ## @name cesium.vwf
- ## @namespace
- ---
- extends: http://vwf.example.com/node.vwf
- implements:
- - http://vwf.example.com/animation.vwf
- properties:
- visible: true
- position: [ 0, 0, 0 ]
- color: [ 255, 255, 255, 1 ]
- modelMatrix:
- methods:
- translateBy:
- translateTo:
- scripts:
- - |
- this.translationFromValue = function( value ) {
- return value && value.length >= 3 ? value : goog.vec.Vec3.create();
- }
- this.translateBy = function( translation, duration ) {
- var pos = this.position;
- var startPosition = goog.vec.Vec3.createFloat32FromArray( pos );
- var deltaPosition = goog.vec.Vec3.createFloat32FromArray( translation );
- var stopPosition = goog.vec.Vec3.add(
- startPosition,
- deltaPosition,
- goog.vec.Vec3.create()
- );
- if( duration > 0 ) {
- this.animationDuration = duration;
- this.animationUpdate = function( time, duration ) {
- this.position = goog.vec.Vec3.lerp(
- startPosition, stopPosition,
- time >= duration ? 1 : time / duration,
- goog.vec.Vec3.create()
- );
- }
- this.animationPlay();
- }
- else {
- this.position = stopPosition;
- }
- }
- this.translateTo = function( translation, duration ) {
- var pos = this.position;
- var startPosition = goog.vec.Vec3.createFloat32FromArray( pos );
- var stopPosition = goog.vec.Vec3.createFloat32FromArray( translation );
- var deltaPosition = goog.vec.Vec3.subtract(
- startPosition,
- stopPosition,
- goog.vec.Vec3.create()
- );
- if( duration > 0 ) {
- this.animationDuration = duration;
- this.animationUpdate = function( time, duration ) {
- this.position = goog.vec.Vec3.lerp(
- startPosition, stopPosition,
- time >= duration ? 1 : time / duration,
- goog.vec.Vec3.create()
- );
- }
- this.animationPlay();
- }
- else {
- this.position = stopPosition;
- }
- } //@ sourceURL=cesium.node3.vwf
|