Browse Source

add sonic pi synth osc example, update info

Nikolay Suslov 6 years ago
parent
commit
ece560c733

+ 95 - 0
public/defaults/addon/sonic-pi_osc.txt

@@ -0,0 +1,95 @@
+set :tC1, current_time
+oldT1 = 0
+set :tC2, current_time
+oldT2 = 0
+set :tC3, current_time
+oldT3 = 0
+
+latency = 0.2
+
+#use_sched_ahead_time 0.4
+#set_sched_ahead_time! 0.3
+
+live_loop :sample01 do
+  
+  use_sched_ahead_time latency
+  
+  a = sync "/osc/trigger/sample01"
+  nowT = a[0]
+  inc = nowT - oldT1
+  oldT1 = nowT
+  print inc
+  
+  delta = (get[:tC1] - current_time) + inc #0.25
+  print delta
+  
+  if(delta > 0.1 )
+    delta = 0
+  end
+  if(delta < -0.1 )
+    delta = 0
+  end
+  
+  time_warp delta do
+    t = current_time
+    set :tC1, t
+    sample a[1], amp: a[2]
+  end
+  
+end
+
+live_loop :sample02 do
+  
+  use_sched_ahead_time latency
+  
+  a = sync "/osc/trigger/sample02"
+  nowT = a[0]
+  inc = nowT - oldT2
+  oldT2 = nowT
+  print inc
+  
+  delta = (get[:tC2] - current_time) + inc #0.25
+  print delta
+  if(delta > 0.1 )
+    delta = 0
+  end
+  if(delta < -0.1 )
+    delta = 0
+  end
+  
+  time_warp delta do
+    t = current_time
+    set :tC2, t
+    print current_time
+    sample a[1], amp: a[2]
+  end
+  
+end
+
+live_loop :synth01 do
+  
+  use_sched_ahead_time latency
+  
+  a = sync "/osc/trigger/synth01"
+  nowT = a[0]
+  inc = nowT - oldT3
+  oldT3 = nowT
+  print inc
+  
+  delta = (get[:tC3] - current_time) + inc #0.25
+  print delta
+  if(delta > 0.1 )
+    delta = 0
+  end
+  if(delta < -0.1 )
+    delta = 0
+  end
+  
+  time_warp delta do
+    t = current_time
+    set :tC3, t
+    print current_time
+    synth a[1], note: a[2], cutoff: a[3], sustain: a[4], amp: 0.15
+  end
+  
+end

+ 0 - 500
public/defaults/animation/animation.vwf.yaml

@@ -1,500 +0,0 @@
-# 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.
-
-## `animation.vwf` adds standard animation functions to a node.
-## 
-## Animations play over a given `animationDuration` and at a given `animationRate` with respect to
-## simulation time. `animationTime` tracks time as the animation plays. Setting `animationTime`
-## moves the animation. The animation plays once to the end, or with `animationLoop` repeats
-## indefinitely.
-## 
-## Events are sent to indicate `animationStarted`, `animationStopped` and `animationLooped`. Changes
-## to the animation time are announced with `animationTimeChanged.`
-##
-## A node may provide an `animationUpdate` method to calculate its own animation state, or it may
-## use a specialized behavior that implements a standard animation.
-## 
-## @name animation.vwf
-## @namespace
-
-# The duration must be a non-negative number, times are always in the range [ `0`, `duration` ], and
-# the rate may be any number (although there is little protection against rates very near zero).
-# 
-#   0 <= animationDuration
-#   0 <= animationTime <= animationDuration
-#   -Infinity < animationRate < Infinity
-# 
-# The animation play state and time index are maintained in `animationStart$` and
-# `animationPause$`. `animationPause$` is `null` while the animation is playing. The
-# distance from `animationStart$` to the current time (when playing) or `animationPause$`
-# (when paused) gives the time index, after accounting for the play rate.
-# 
-#   animationTime = ( ( animationPause$ || time ) - ( animationStart$ || time ) ) *
-#     animationRate (positive rates)
-#   animationTime = ( ( animationPause$ || time ) - ( animationStart$ || time ) ) *
-#     animationRate + animationDuration (negative rates)
-# 
-#   animationPlaying = this.animationStart$ != null && this.animationPause$ == null
-# 
-# `animationStart$` and `animationPause$` are `null` before the animation is first played.
-# This state is interpreted as `animationPlaying` == `false` and `animationTime` == `0`.
-# 
-#   animationStart$ == null => animationPause$ == null
-#   animationStart$ == null => animationStop$ == null
-# 
-#   animationStart$ != null => animationStart$ <= time
-#   animationPause$ != null => animationStart$ <= animationPause$ <= time
-#   animationStop$ != null => animationStart$ + animationDuration$ == animationStop$
-# 
-#   animationDuration$ == animationDuration / animationRate (positive rates)
-#   animationDuration$ == -animationDuration / animationRate (negative rates)
-# 
-# Properties named with a`$` suffix refer to times or durations on the simulation timeline. All
-# other time-related properties refer to the animation timeline.
-
----
-
-properties:
-
-  ## The current animation position in seconds.
-  ## 
-  ## `animationTime` automatically moves with the simulation time while the animation is playing,
-  ## tracking the change in time multiplied by `animationRate`. A negative `animationRate` will
-  ## cause `animationTime` to move backwards. Setting `animationTime` updates the postion whether or
-  ## not the animation is currently playing.
-
-  animationTime:
-
-    set: |
-      if(this.animationStartTime == null) {
-        this.animationStartTime = 0;
-      }
-      if(this.animationStopTime == null) {
-        this.animationStopTime = this.animationDuration;
-      }
-      // Save copies to avoid repeated reads.
-      var duration = this.animationStopTime - this.animationStartTime,
-        rate = this.animationRate;
-      // Range limit the incoming value.
-      value = Math.min( Math.max( this.animationStartTime, value ), this.animationStopTime );
-      // Keep paused if updating start/pause from null/null. Use t=0 instead of `this.time` so that
-      // setting `node.animationTime` during initialization is consistent across multiple clients.
-      if ( this.animationStart$ == null ) {
-        this.animationPause$ = 0;
-      }
-      // Calculate the start and stop times that makes the new time work.
-      this.animationStart$ =
-        ( this.animationPause$ != null ? this.animationPause$ : this.time ) -
-        ( rate >= 0 ? value - this.animationStartTime : value - duration ) / rate;
-      this.animationStop$ =
-        this.animationStart$ +
-        ( rate >= 0 ? duration : -duration ) / rate;
-      // Update the node and fire the changed event.
-      if ( value !== this.animationTimeUpdated ) {
-        this.animationTimeUpdated = value;
-        this.animationUpdate( value, this.animationDuration );
-        this.animationTimeChanged( value );
-      } //@ sourceURL=animation.animationTime.set.vwf
-
-    get: |
-      // Save copies to avoid repeated reads.
-      var startTime = this.animationStartTime;
-      var stopTime = this.animationStopTime;
-      var rate = this.animationRate;
-      var animationPause$ = this.animationPause$;
-      var animationStart$ = this.animationStart$;
-      var time = this.time;
-      // Calculate the time from the start and current/pause times.
-      var value = (
-        ( animationPause$ != null ? animationPause$ : time ) -
-        ( animationStart$ != null ? animationStart$ : time )
-      ) * rate + ( rate >= 0 ? startTime : stopTime );
-      // Range limit the value.
-      value = Math.min( Math.max( startTime, value ), stopTime );
-      // If changed since last seen, update and fire the changed event.
-      if ( value !== this.animationTimeUpdated ) {
-        this.animationTimeUpdated = value;
-        this.animationUpdate( value, this.animationDuration );
-        this.animationTimeChanged( value );
-      }
-      return value; //@ sourceURL=animation.animationTime.get.vwf
-
-  ## The length of the animation in seconds.
-  ## 
-  ## `animationTime` will always be within the range [ `0`, `animationDuration` ]. Animations
-  ## automatically stop playing once `animationTime` reaches `animationDuration` unless
-  ## `animationLoop` is set. Animations with a negative `animationRate` start at
-  ## `animationDuration` and stop at `0`.
-
-  animationDuration:  # TODO: allow changes while playing
-    set: |
-      var duration = value, rate = this.animationRate;
-      this.animationDuration = duration;
-      this.animationDuration$ = ( rate >= 0 ? duration : -duration ) / rate;
-    value: 1
-
-  ## The animation playback rate.
-  ## 
-  ## Set `animationRate` to a value greater than `1` to increase the rate. Set a value between `0`
-  ## and `1` to decrease it. Negative rates will cause the animation to play backwards.
-
-  animationRate:  # TODO: allow changes while playing
-    set: |
-      var duration = this.animationDuration, rate = value;
-      this.animationRate = rate;
-      this.animationDuration$ = ( rate >= 0 ? duration : -duration ) / rate;
-    value: 1
-
-  ## Automatically replay the animation from the start after reaching the end.
-
-  animationLoop: false
-
-  ## The animation's play/pause control.
-
-  animationPlaying:
-
-    set: |
-      if(this.animationStartTime == null) {
-        this.animationStartTime = 0;
-      }
-      if(this.animationStopTime == null) {
-        this.animationStopTime = this.animationDuration;
-      }
-      if ( this.animationStart$ != null && this.animationPause$ == null ) {
-        if ( ! value ) {
-          // Mark as paused at the current time.
-          this.animationPause$ = this.time;
-          // Send the `animationStopped` event if stopping at the end.
-          if ( this.time == this.animationStop$ ) {
-            this.animationStopped();
-          }
-        }
-      } else {
-        if ( value ) {
-          // Save copies to avoid repeated reads.
-          var duration = this.animationStopTime - this.animationStartTime,
-            rate = this.animationRate;
-          // Start from the beginning if resuming from the end.
-          if ( this.animationPause$ == this.animationStop$ ) {
-            this.animationPause$ = this.animationStart$;
-          }
-          // Recalculate the start and stop times to keep paused time unchanged, then resume.
-          this.animationStart$ =
-            ( this.animationStart$ != null ? this.animationStart$ : this.time ) -
-            ( this.animationPause$ != null ? this.animationPause$ : this.time ) +
-            this.time;
-          this.animationStop$ =
-            this.animationStart$ +
-            ( rate >= 0 ? duration : -duration ) / rate;
-          this.animationPause$ = null;
-          // Send the `animationStarted` event if starting from the beginning.
-          if ( this.time == this.animationStart$ ) {
-            this.animationStarted();
-          }
-          // Start the animation worker.
-          this.logger.debug( "scheduling animationTick" );
-          this.animationTick();
-        }
-      } //@ sourceURL=animation.animationPlaying.set.vwf
-
-    get: |
-      return this.animationStart$ != null && this.animationPause$ == null;
-
-  ## The most recent value of `animationTime` recognized by this behavior.
-  ## 
-  ## Each `animationTime` change causes `animationUpdate` to be called. `animationTimeUpdated`
-  ## records the value of `animationTime` from the last time this occurred.
-  ## 
-  ## `animationTimeUpdated` is for internal use. Do not set this property.
-
-  animationTimeUpdated: null
-
-  ## The simulation time corresponding to the start of the animation.
-  ## 
-  ## `animationStart$` is `null` until the animation is first played. `animationPlaying` is
-  ## `false` and `animationTime` is `0` while `animationStart$` is `null`.
-  ## 
-  ## `animationStart$` is for internal use. Do not set this property.
-
-  animationStart$: null
-
-  ## The simulation time corresponding to the animation's pause position.
-  ## 
-  ## `animationPause$` is `null` while the animation is playing and before the animation is
-  ## first played.
-  ## 
-  ## `animationPause$` is for internal use. Do not set this property.
-
-  animationPause$: null
-
-  ## The simulation time corresponding to the end of the animation. The animation worker function
-  ## loops or stops the animation when `time` reaches this value.
-  ## 
-  ## `animationStop$` is for internal use. Do not set this property.
-
-  animationStop$: null
-
-  ## The animation's duration in simulation time, after considering `animationRate`.
-  ## 
-  ## `animationDuration$` is for internal use. Do not set this property.
-
-  animationDuration$: null
-
-  ## The time that the animation should start at. Used with animationStopTime to play
-  ## a subsection of the animation. Defaults to 0 when the animation starts to play
-  ## if it is not assigned another value. 'animationStartTime' will always be within 
-  ## the range [ `0`, `animationDuration` ]
-
-  animationStartTime: 
-    set: |
-      this.animationStartTime = value ? Math.min( Math.max( 0, value ), this.animationDuration ) : value;
-    value: null
-
-  ## The time that the animation should stop at. Used with animationStartTime to play
-  ## a subsection of the animation. Defaults to 'animationDuration' when the animation
-  ## starts to play if it is not assigned another value. 'animationStopTime' will always
-  ## be within the range [ `0`, `animationDuration` ]
-
-  animationStopTime:  
-    set: |
-      this.animationStopTime = value ? Math.min( Math.max( 0, value ), this.animationDuration ) : value;
-    value: null
-
-  ## The frame that the animation should start at. Setting this value automatically updates the "animationStartTime"
-  ## to the "animationStartFrame" / "fps"
-
-  animationStartFrame:
-    set: |
-      this.animationStartTime = value / this.animationFPS;
-    get: |
-      return Math.floor(this.animationStartTime * this.animationFPS);
-
-  ## The frame that the animation should stop at. Setting this value automatically updates the "animationStopTime"
-  ## to the "animationStopFrame" / "fps"
-
-  animationStopFrame:
-    set: |
-      this.animationStopTime = value / this.animationFPS;
-    get: |
-      return Math.floor(this.animationStopTime * this.animationFPS);
-
-  ## The frames per second of the animation loaded from the source model.
-
-  animationFPS: 30
-
-  ## The number of frames of the animation loaded from the source model. 
-  animationFrames:
-    set: |
-      this.animationDuration = value / this.animationFPS;
-    get: |
-      return Math.ceil(this.animationFPS * this.animationDuration); 
-
-  ## The current frame the animation is on. Equivalent to animationTime.
-  animationFrame:
-    set: |
-      if(this.animationFPS) {
-        this.animationTime = value / this.animationFPS;
-      }
-    get: |
-      if(this.animationFPS) {
-        return Math.floor(this.animationTime * this.animationFPS);
-      }
-
-  ## The animation update rate in ticks per second of simulation time.
-
-  animationTPS: 60
-
-methods:
-
-  # Play the animation from the start.
-
-  animationPlay:
-    parameters:
-      - startTime
-      - stopTime
-    body: |
-      if(!isNaN(stopTime)) {
-        this.animationStopTime = stopTime;
-      }
-      if(!isNaN(startTime)) {
-        this.animationStartTime = startTime;
-      }
-      this.animationPlaying = true;
-
-  # Pause the animation at the current position.
-
-  animationPause: |
-    this.animationPlaying = false;
-
-  # Resume the animation from the current position.
-
-  animationResume: |
-    this.animationPlaying = true;
-
-  # Stop the animation and reset the position to the start.
-
-  animationStop: |
-    this.animationPlaying = false;
-    this.animationTime = 0;
-
-  ## Update the animation. If `animationTime` has reached the end, stop or loop depending on the
-  ## `animationLoop` setting. Schedule the next tick if the animation did not stop.
-  ## 
-  ## `animationTick` is for internal use. Do not call this method directly.
-
-  animationTick: |
-    if ( this.animationPlaying ) {
-      // Read the time to recognize the current time and update.
-      // TODO: move side effects out of the getter!!! (says Kevin)
-      this.animationTime; 
-      // Loop or stop after reaching the end.
-      if ( this.time === this.animationStop$ ) {
-        if ( this.animationLoop ) {
-          this.animationLooped();
-          this.animationTime = this.animationRate >= 0 ?
-            this.animationStartTime : this.animationStopTime;
-        } else {
-          this.animationPlaying = false;
-        }
-      }
-      // Schedule the next tick if still playing.
-      if ( this.animationPlaying ) {
-        if ( this.animationStop$ - this.time > 1 / this.animationTPS ) {
-          this.in( 1 / this.animationTPS ).animationTick(); // next interval
-        } else {
-
-          // TODO: When animationStop$ is 0 (usually when a model does not actually have an 
-          //       animation on it), we schedule a method call for a time in the past (at time 0).
-          //       That immediately calls animationTick again, but this.time does not equal 
-          //       animationStop$ as we would expect.  So, it doesn't stop the animation and we get
-          //       caught in an infinite loop.
-          //       Ideally we should catch the case where animationStop$ is 0 before this point.
-          //       But for now, we catch it here.  
-          if ( this.animationStop$ > 0 ) {
-            this.at( this.animationStop$ ).animationTick(); // exactly at end
-          } else {
-            this.animationPlaying = false;
-          }
-        }
-      } else {
-        this.logger.debug( "canceling animationTick" );
-      }
-    } //@ sourceURL=animation.animationTick.vwf
-
-  ## `animation.vwf` calls `animationUpdate` each time `animationTime` changes. Nodes that
-  ## implement `animation.vwf` should provide an `animationUpdate` method to calculate the animation
-  ## state appropriate for the node.
-  ## 
-  ## Since this event is sent within the `animationTime` getter function, references to
-  ## `this.animationTime` will return `undefined` due to reentrancy protections. Use the provided
-  ## `time` parameter instead.
-  ## 
-  ## @param {Number} time
-  ##   The animation's `animationTime`.
-  ## @param {Number} duration
-  ##   The animation's `animationDuration`.
-
-  animationUpdate:
-    parameters:
-      - time
-      - duration
-
-events:
-
-  # Sent when the animation starts playing from the beginning.
-
-  animationStarted:
-
-  # Sent when the animation reaches the end and `animationLoop` is not set.
-
-  animationStopped:
-
-  # Sent when the animation reaches the end and `animationLoop` is set.
-
-  animationLooped:
-
-  ## Sent each time `animationTime` changes.
-  ## 
-  ## Since this event is sent within the `animationTime` getter function, references to
-  ## `this.animationTime` will return `undefined` due to reentrancy protections. Use the provided
-  ## `time` parameter instead.
-  ## 
-  ## @param {Number} time
-  ##   The animation's `animationTime`.
-
-  animationTimeChanged:
-    parameters:
-      - time
-scripts:
-- |
-  this.initialize = function() {
-
-    // Locate child nodes that extend or implement "http://vwf.example.com/animation/position.vwf"
-    // to identify themselves as animation key positions.
-
-    var positions = this.find( "./element(*,'http://vwf.example.com/animation/position.vwf')" );
-
-    // Fill in missing `animationTime` properties, distributing evenly between the left and right
-    // positions that define `animationTime`.
-
-    // 1: [ - ] => [ 0 ]
-    // 1: [ 0, - ] => [ 0, 1 ]
-    // 1: [ -, 1 ] => [ 0, 1 ]
-    // 1: [ 0, -, - ] => [ 0, 1/2, 1 ]
-    // 1: [ -, -, 1 ] => [ 0, 1/2, 1 ]
-    // 1: [ 0, - , -, 1 ] => [ 0, 1/3 , 2/3, 1 ]
-
-    var leftTime, leftIndex;
-    var rightTime, rightIndex = -Infinity;
-
-    if ( positions.length > 0 ) {
-      
-      positions.sort(function(a, b) {
-        return a.sequence - b.sequence;
-      });
-
-      if ( positions[0].animationTime === null ) {
-        positions[0].animationTime = 0;
-      }
-
-      if ( positions[positions.length-1].animationTime === null ) {
-        positions[positions.length-1].animationTime = this.animationDuration;
-      }
-
-      positions.forEach( function( position, index ) {
-
-        if ( position.animationTime !== null ) {
-
-          leftTime = position.animationTime;
-          leftIndex = index;
-
-        } else {
-
-          if ( index > rightIndex ) {
-            for ( rightIndex = index + 1; rightIndex < positions.length; rightIndex++ ) {
-              if ( ( rightTime = /* assignment! */ positions[rightIndex].animationTime ) !== null ) {
-                break;
-              }
-            }
-          }
-
-          position.animationTime = leftTime + ( rightTime - leftTime ) *
-            ( index - leftIndex )  / ( rightIndex - leftIndex );
-
-        }
-
-      }, this );
-
-    }
-
-  } //@ sourceURL=http://vwf.example.com/animation.vwf/scripts~initialize

+ 0 - 420
public/defaults/animation/animationNode.vwf.yaml

@@ -1,420 +0,0 @@
-# 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.
-
-## @name node3.animation.vwf
-## @namespace
-
----
-extends:
-  http://vwf.example.com/animation/animation.vwf
-methods:
-  animationUpdate:
-    parameters:
-      - time
-      - duration
-  ## Translate by given translation over duration.
-  ## 
-  ## @name node3.animation.vwf#translateBy
-  ## @function
-  ##
-  ## @param {Array} translation
-  ## @param {Number} duration
-  ##
-  ## @returns undefined
-  translateBy:
-    parameters:
-      - translation
-      - duration
-    body: |
-      this.startTranslation$ = this.translation || goog.vec.Vec3.create();
-      var deltaTranslation = this.translationFromValue( translation );
-      this.stopTranslation$ = goog.vec.Vec3.add(
-        this.startTranslation$,
-        deltaTranslation,
-        goog.vec.Vec3.create()
-      );
-      if(duration > 0) {
-        this.animationDuration = duration;
-        this.animationUpdate = function(time, duration) {
-          this.translation = goog.vec.Vec3.lerp(
-            this.startTranslation$, this.stopTranslation$,
-            time >= duration ? 1 : time / duration,
-            goog.vec.Vec3.create()
-          );
-        }
-        this.animationPlay(0, duration);
-      }
-      else {
-        this.translation = this.stopTranslation$;
-      } //@ sourceURL=node3.animation.translateBy.vwf
-
-  ## Translate to given translation over duration.
-  ## 
-  ## @name node3.animation.vwf#translateTo
-  ## @function
-  ##
-  ## @param {Array} translation
-  ## @param {Number} duration
-  ##
-  ## @returns undefined
-  translateTo:
-    parameters:
-      - translation
-      - duration
-    body: |
-      this.startTranslation$ = this.translation || goog.vec.Vec3.create();
-      this.stopTranslation$ = this.translationFromValue( translation );
-      if(duration > 0) {
-        this.animationDuration = duration;
-        this.animationUpdate = function(time, duration) {
-          this.translation = goog.vec.Vec3.lerp(
-            this.startTranslation$, this.stopTranslation$,
-            duration == 0 ? duration : time / duration,
-            goog.vec.Vec3.create()
-          );
-        }
-        this.animationPlay(0, duration);
-      }
-      else {
-        this.translation = this.stopTranslation$;
-      } //@ sourceURL=node3.animation.translateTo.vwf
-
-  ## Rotate by given rotation over duration.
-  ## 
-  ## @name node3.animation.vwf#rotateBy
-  ## @function
-  ## 
-  ## @param {Array} rotation
-  ## @param {Number} [duration]
-  ## @param {String} [frame]
-  ## 
-  ## @returns undefined
-  rotateBy:
-    parameters:
-      - rotation
-      - duration
-      - frame
-    body: |
-      var rotation = this.rotationFromValue( rotation );
-      var deltaQuaternion = goog.vec.Quaternion.fromAngleAxis(
-        rotation[3] * Math.PI / 180,
-        goog.vec.Vec3.createFromValues( rotation[0], rotation[1], rotation[2] ),
-        goog.vec.Quaternion.create()
-      );
-      this.quaterniateBy( deltaQuaternion, duration, frame ); //@ sourceURL=node3.animation.rotateBy.vwf
-
-  ## Rotate to given rotation over duration.
-  ## 
-  ## @name node3.animation.vwf#rotateTo
-  ## @function
-  ## 
-  ## @param {Array} rotation
-  ## @param {Number} duration
-  ## 
-  ## @returns undefined
-  rotateTo:
-    parameters:
-      - rotation
-      - duration
-    body: |
-      var rotation = this.rotationFromValue( rotation );
-      var stopQuaternion = goog.vec.Quaternion.fromAngleAxis(
-        rotation[3] * Math.PI / 180,
-        goog.vec.Vec3.createFromValues( rotation[0], rotation[1], rotation[2] ),
-        goog.vec.Quaternion.create()
-      );
-      this.quaterniateTo( stopQuaternion, duration ); //@ sourceURL=node3.animation.rotateTo.vwf
-
-  ## Rotate by given quaternion over duration.
-  ## 
-  ## @name node3.animation.vwf#quaterniateBy
-  ## @function
-  ## 
-  ## @param {Array} quaternion
-  ## @param {Number} [duration]
-  ## @param {String} [frame]
-  ## 
-  ## @returns undefined
-  quaterniateBy:
-    parameters:
-      - quaternion
-      - duration
-      - frame
-    body: |
-      this.startQuaternion$ = this.quaternion || goog.vec.Quaternion.createFromValues( 0, 0, 0, 1 );
-      var deltaQuaternion = this.quaternionFromValue( quaternion );
-      if ( ! frame || frame == "rotated" ) {
-        this.stopQuaternion$ = goog.vec.Quaternion.concat(
-          deltaQuaternion,
-          this.startQuaternion$,
-          goog.vec.Quaternion.create()
-        );
-      } else if ( frame == "scaled" ) {
-        this.stopQuaternion$ = goog.vec.Quaternion.concat(
-          this.startQuaternion$,
-          deltaQuaternion,
-          goog.vec.Quaternion.create()
-        );
-      }
-      if(duration > 0) {
-        this.animationDuration = duration;
-        this.animationUpdate = function(time, duration) {
-          this.quaternion = goog.vec.Quaternion.slerp(
-            this.startQuaternion$, this.stopQuaternion$,
-            time >= duration ? 1 : time / duration,
-            goog.vec.Quaternion.create()
-          );
-        }
-        this.animationPlay(0, duration);
-      }
-      else {
-        this.quaternion = this.stopQuaternion$;
-      } //@ sourceURL=node3.animation.quaterniateBy.vwf
-
-  ## Rotate to given quaternion over duration.
-  ## 
-  ## @name node3.animation.vwf#quaterniateTo
-  ## @function
-  ## 
-  ## @param {Array} quaternion
-  ## @param {Number} duration
-  ## 
-  ## @returns undefined
-  quaterniateTo:
-    parameters:
-      - quaternion
-      - duration
-    body: |
-      this.startQuaternion$ = this.quaternion || goog.vec.Quaternion.createFromValues( 0, 0, 0, 1 );
-      this.stopQuaternion$ = this.quaternionFromValue( quaternion );
-      if(duration > 0) {
-        this.animationDuration = duration;
-        this.animationUpdate = function(time, duration) {
-          this.quaternion = goog.vec.Quaternion.slerp(
-            this.startQuaternion$, this.stopQuaternion$,
-            duration == 0 ? duration : time / duration,
-            goog.vec.Quaternion.create()
-          );
-        }
-        this.animationPlay(0, duration);
-      }
-      else {
-        this.quaternion = this.stopQuaternion$;
-      } //@ sourceURL=node3.animation.quaterniateTo.vwf
-
-  ## Scale by given scale over duration.
-  ## 
-  ## @name node3.animation.vwf#scaleBy
-  ## @function
-  ## 
-  ## @param {Array} scale
-  ## @param {Number} duration
-  ## 
-  ## @returns undefined
-  scaleBy:
-    parameters:
-      - scale
-      - duration
-    body: |
-      this.startScale$ = this.scale || goog.vec.Vec3.createFromValues( 1, 1, 1 );
-      var deltaScale = this.scaleFromValue( scale );
-      this.stopScale$ = goog.vec.Vec3.createFromValues(
-        this.startScale$[0] * deltaScale[0],
-        this.startScale$[1] * deltaScale[1],
-        this.startScale$[2] * deltaScale[2]
-      );
-      if(duration > 0) {
-        this.animationDuration = duration;
-        this.animationUpdate = function(time, duration) {
-          this.scale = goog.vec.Vec3.lerp(  // TODO: should be geometric interpolation
-            this.startScale$, this.stopScale$,
-            duration == 0 ? duration : time / duration,
-            goog.vec.Vec3.create()
-          );
-        }
-        this.animationPlay(0, duration);
-      }
-      else {
-        this.scale = this.stopScale$;
-      } //@ sourceURL=node3.animation.scaleBy.vwf
-
-  ## Scale to given scale over duration.
-  ## 
-  ## @name node3.animation.vwf#scaleTo
-  ## @function
-  ## 
-  ## @param {Array} scale
-  ## @param {Number} duration
-  ## 
-  ## @returns undefined
-  scaleTo:
-    parameters:
-      - scale
-      - duration
-    body: |
-      this.startScale$ = this.scale || goog.vec.Vec3.createFromValues( 1, 1, 1 );
-      this.stopScale$ = this.scaleFromValue( scale );
-      if(duration > 0) {
-        this.animationDuration = duration;
-        this.animationUpdate = function(time, duration) {
-          this.scale = goog.vec.Vec3.lerp(  // TODO: should be geometric interpolation
-            this.startScale$, this.stopScale$,
-            duration == 0 ? duration : time / duration,
-            goog.vec.Vec3.create()
-          );
-        }
-        this.animationPlay(0, duration); 
-      }
-      else {
-        this.scale = this.stopScale$;
-      }//@ sourceURL=node3.animation.scaleTo.vwf
-
-  ## Transform by the given amount over duration.
-  ## 
-  ## @name node3.animation.vwf#transformBy
-  ## @function
-  ##
-  ## @param {Array} transform
-  ## @param {Number} duration
-  ##
-  ## @returns undefined
-  transformBy:
-    parameters:
-      - transform
-      - duration
-    body: |
-      var startTransform = this.transform || goog.vec.Vec3.create();
-      var deltaTransform = this.transformFromValue( transform );
-      // Left multiply by the delta
-      var stopTransform = goog.vec.Mat4.multMat( deltaTransform, startTransform, goog.vec.Mat4.createFloat32() );
-      this.transformTo( stopTransform, duration ); //@ sourceURL=node3.animation.transformBy.vwf
-
-  ## Transform to given transform over duration.
-  ## 
-  ## @name node3.animation.vwf#transformTo
-  ## @function
-  ##
-  ## @param {Array} transform
-  ## @param {Number} duration
-  ##
-  ## @returns undefined
-  transformTo:
-    parameters:
-      - transform
-      - duration
-    body: |
-      var stopTransform = this.transformFromValue( transform ) || goog.vec.Mat4.createIdentity();
-
-      if ( duration > 0 ) {
-
-        // Calculate the start and stop translations
-        this.startTranslation$ = this.translation || goog.vec.Vec3.create();
-        this.stopTranslation$ = goog.vec.Vec3.create();
-        goog.vec.Mat4.getColumn( stopTransform, 3, this.stopTranslation$ );
-        // Calculate the start and stop quaternion and scale
-        this.startScale$ = this.scale || goog.vec.Vec3.createFromValues( 1, 1, 1 );
-        this.stopScale$ = goog.vec.Vec3.create();
-        this.startQuaternion$ = this.quaternion || goog.vec.Quaternion.createFromValues( 0, 0, 0, 1 );
-        this.stopQuaternion$ = goog.vec.Quaternion.fromRotationMatrix4(
-          this.unscaledTransform( stopTransform || goog.vec.Mat4.createIdentity(), this.stopScale$, goog.vec.Mat4.create() ),
-          goog.vec.Quaternion.create()
-        );
-
-        this.animationDuration = duration;
-        // Call the appropriate functions to do the translation and quaterniation (that is totally a word)
-        this.animationUpdate = function(time, duration) {
-          this.translation = goog.vec.Vec3.lerp(
-            this.startTranslation$, this.stopTranslation$,
-            duration == 0 ? duration : time / duration,
-            goog.vec.Vec3.create()
-          );
-          this.quaternion = goog.vec.Quaternion.slerp(
-            this.startQuaternion$, this.stopQuaternion$,
-            duration == 0 ? duration : time / duration,
-            goog.vec.Quaternion.create()
-          );
-          this.scale = goog.vec.Vec3.lerp(  // TODO: should be geometric interpolation
-            this.startScale$, this.stopScale$,
-            duration == 0 ? duration : time / duration,
-            goog.vec.Vec3.create()
-          );
-        }
-        this.animationPlay(0, duration);
-      }
-      else {
-        this.transform = stopTransform;
-      } //@ sourceURL=node3.animation.transformTo.vwf
-
-  ## Transform the world transform by the given amount over duration.
-  ## 
-  ## @name node3.animation.vwf#worldTransformBy
-  ## @function
-  ##
-  ## @param {Array} transform
-  ## @param {Number} duration
-  ##
-  ## @returns undefined
-  worldTransformBy:
-    parameters:
-      - transform
-      - duration
-    body: |
-      var startWorldTransform = this.worldTransform || goog.vec.Mat4.create();
-      var deltaTransform = this.transformFromValue( transform );
-      // Left multiply by the delta
-      var stopWorldTransform = goog.vec.Mat4.multMat( deltaTransform, startWorldTransform, 
-                                                      goog.vec.Mat4.createFloat32() );
-      this.worldTransformTo( stopWorldTransform, duration ) //@ sourceURL=node3.animation.worldTransformBy.vwf
-
-  ## Transform the world transform to given transform over duration.
-  ## 
-  ## @name node3.animation.vwf#worldTransformTo
-  ## @function
-  ##
-  ## @param {Array} transform
-  ## @param {Number} duration
-  ##
-  ## @returns undefined
-  worldTransformTo:
-    parameters:
-      - transform
-      - duration
-    body: |
-      var stopWorldTransform = this.transformFromValue( transform );
-      var stopTransform;
-      if ( this.parent && this.parent.worldTransform ) {
-        // We need to find the local transform that will bring about the desired world transform
-        // The math for this looks like -
-        // (new worldTransform) = (parentWorldTransform) * (transform)
-        // So, if we left multiply both sides by the inverse of the parentWorldTransform...
-        // inv(parentWorldTransform) * (new worldTransform) = (transform)
-        // Find the inverse parent worldTransform
-        var inverseParentWorldTransform = goog.vec.Mat4.createFloat32();
-        if ( goog.vec.Mat4.invert( this.parent.worldTransform, inverseParentWorldTransform ) ) {
-          // Left multiply the new worldTransform by the inverse parent worldTransform
-          stopTransform = goog.vec.Mat4.multMat( inverseParentWorldTransform, stopWorldTransform,
-                                                 goog.vec.Mat4.createFloat32() );
-        }
-        else {
-          stopTransform = goog.vec.Mat4.createIdentity();
-          this.logger.error( "Parent '" + this.parent.id + "' transform matrix is not invertible: " + 
-                             this.parent.transform );
-        }
-      }
-      else {
-        stopTransform = stopWorldTransform;
-      }
-      this.transformTo( stopTransform, duration ); //@ sourceURL=node3.animation.worldTransformTo.vwf
-
-event: 
-  changingTransformFromView:

+ 0 - 57
public/defaults/animation/position.vwf.yaml

@@ -1,57 +0,0 @@
-# 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.
-
-## `animation.position.vwf` defines a key value for an animation.
-##
-## @name animation.position.vwf
-## @namespace
-
----
-
-properties:
-
-  ## This position's location on the animation timeline. Valid values are in the range from `0` to
-  ## the animation's duration.
-  ## 
-  ## Positions that don't provide `time` will be automatically distributed along the range between
-  ## the siblings that do. If none of a node's animation positions provide `time`, then the
-  ## positions will be distributed evenly throughout the animation--in the range [`0`, *duration*].
-  ## 
-  ## @name animation.position.vwf#animationTime
-  ## @property
-
-  animationTime:
-
-  ## The animated node's transform at this position. The node's transform will be set to this value
-  ## when the animations reaches this position. Transforms for intermediate postions will be
-  ## interpolated from the transforms of the adjacent positions.
-  ##
-  ## if no times, distribute evenly over number of children
-  ## transforms optional; only for node3 animations, and may be provided by asset or by node's update
-  ## 
-  ## @name animation.position.vwf#animationTransform
-  ## @property
-
-  animationTransform:
-
-  ## animation positions and control positions are not necessarily coincident, although they typically are
-  ## animation data may be missing from control positions if no transform is necessary
-  ## control data may be missing from animation positions if value/time == 1, attraction does not change
-  ##
-  ## The sequence of the animation key value. Key values will be sorted on the sequence to keep the order correct,
-  ## because Ruby 1.8.7 doesn't preserve child order in component objects.
-  ## 
-  ## @name animation.position.vwf#sequence
-  ## @property
-
-  sequence: 0

+ 2 - 2
public/defaults/worlds/orchestra/info.json

@@ -2,12 +2,12 @@
     "info": {
         "en": {
             "title": "Collaborative Orchestra for VWF & Sonic Pi",
-            "imgUrl": "/defaults/worlds/aframe2/webimg.jpg",
+            "imgUrl": "/defaults/worlds/orchestra/webimg.jpg",
             "text": "Example app for making music"
         },
         "ru": {
             "title": "Оркестр",
-            "imgUrl": "/defaults/worlds/aframe2/webimg.jpg",
+            "imgUrl": "/defaults/worlds/orchestra/webimg.jpg",
             "text": "Пример мира с текстурами и моделями"
         }
     }

BIN
public/defaults/worlds/orchestra/webimg.jpg


+ 1 - 1
public/vwf/view/osc.js

@@ -101,7 +101,7 @@ define(["module", "vwf/view", "vwf/view/oscjs/dist/osc-module"], function(module
 			this.disconnect();
 
 			this.port = new osc.WebSocketPort({
-                url: 'ws://' + this.hostValue + ':' + this.portValue
+                url: 'wss://' + this.hostValue + ':' + this.portValue
                 //url: "ws://localhost:8081"
             	});
 			

+ 6 - 1
public/web/locale/en/index.html

@@ -31,7 +31,7 @@
       <div id="headerText">
         <h1 class="mdc-typography mdc-typography--headline4 mdc-typography--adjust-margin mdc-theme--text-hint-on-background">Collaborative
           Live Coding Space with support of user-defined languages and WebVR ready 3D graphics.<br> Based on: <strong>Virtual
-            World Framework | A-Frame | Ohm language | OSC.js | Gun DB and more... </strong> by <a class="mdc-typography link-in-text mdc-theme--text-hint-on-background"
+            World Framework | A-Frame | Ohm language | OSC.js |  AR.js | Gun DB and more... </strong> by <a class="mdc-typography link-in-text mdc-theme--text-hint-on-background"
             href="https://www.krestianstvo.org"><strong>Krestianstvo.org</strong></a> </h1>
       </div>
     </div>
@@ -62,6 +62,9 @@
           <li><strong>Multi-window</strong> or multi-monitor/multi-machine setups with view <strong>offset cameras</strong></li>
           <li><strong>WebRTC</strong> for video/audio streaming,<strong>3D positional audio</strong> support</li>
           <li><strong>GearVR, Windows MixedReality</strong> motion controllers</li>
+          <li>(<span id="alpha" style="font-size: 14; color: red">New!</span>)
+            <strong>Augmented Reality </strong> using <a class="mdc-typography link-in-text-vis mdc-theme--text-hint-on-background" href="https://gun.eco/docs/Auth"> AR.js  </a><strong>collaboratively</strong>
+              </li>
         </ul>
         <h4 class="mdc-typography--headline5 mdc-theme--text-hint-on-background"><a class="mdc-typography link-in-text mdc-theme--text-hint-on-background"
           href="https://www.krestianstvo.org/books/doc/sdk3/">Read documentation</a> </h4>
@@ -98,6 +101,8 @@
 
         <iframe src="https://player.vimeo.com/video/251057056?title=0&byline=0&portrait=0" width="600" height="338" frameborder="0"
           webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
+
+          <iframe src="https://player.vimeo.com/video/309193603?title=0&byline=0&portrait=0" width="600" height="338" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
       </div>
     </div>
   </div>