How to use the nudged.Transform function in nudged

To help you get started, we’ve selected a few nudged examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github taataa / tapspace / examples / play / app.js View on Github external
this.endTouchPoint = function (id) {
    // Debug
      if (!pointers.hasOwnProperty(id)) {
        console.error('Pointer ' + id + ' does not exist.')
      }

    // For each removed touch.
      commit()
      delete pointers[id]
      numPointers -= 1
      if (numPointers === 0) {
      // So numPointers was one.
      // So high-level gesture ends.
        this.emit('end', totalTransform)
      // Return transforms to identity.
        committedTransform = nudged.Transform.IDENTITY
        totalTransform = nudged.Transform.IDENTITY
      }
    }
  }
github taataa / tapspace / examples / play / src / Model.js View on Github external
// Debug
    if (!pointers.hasOwnProperty(id)) {
      console.error('Pointer ' + id + ' does not exist.')
    }

    // For each removed touch.
    commit()
    delete pointers[id]
    numPointers -= 1
    if (numPointers === 0) {
      // So numPointers was one.
      // So high-level gesture ends.
      this.emit('end', totalTransform)
      // Return transforms to identity.
      committedTransform = nudged.Transform.IDENTITY
      totalTransform = nudged.Transform.IDENTITY
    }
  }
}
github taataa / tapspace / examples / canvas / app.js View on Github external
// Debug
        if (!pointers.hasOwnProperty(id)) {
          console.error('Pointer ' + id + ' does not exist.')
        }

    // For each removed touch.
        commit()
        delete pointers[id]
        numPointers -= 1
        if (numPointers === 0) {
      // So numPointers was one.
      // So high-level gesture ends.
          this.emit('end', totalTransform)
      // Return transforms to identity.
          committedTransform = nudged.Transform.IDENTITY
          totalTransform = nudged.Transform.IDENTITY
        }
      }
    }
github taataa / tapspace / examples / play / app.js View on Github external
var Model = function () {
    Emitter(this)

  // For ongoing transformation, remember where the pointers started from
  // and keep track where they are now. We store this information to
  // the pointers variable. It has a property for each current pointer.
  //
  // Example:
  // {
  //   'pointerid': {dx: , dy: , rx: , ry}
  // }
    var pointers = {}
    var numPointers = 0

  // Cumulated transformation. Like a history.
    var committedTransform = nudged.Transform.IDENTITY
  // When the history is combined with the ongoing transformation,
  // the result is total transformation.
    var totalTransform = nudged.Transform.IDENTITY

  // Limit the frequency of fired events
  // TODO should be done outside of the Model.
    var previousMoveDateNow = Date.now()

    var commit = function () {
    // Move ongoint transformation to the committed transformation so that
    // the total transformation stays the same.

    // Commit ongoingTransformation. As a result
    // the domain and range of all pointers become equal.
      var id, p, domain, range, t
      domain = []
github taataa / tapspace / lib / SpacePoint.js View on Github external
proto.toSpace = function () {
  // Create a new SpacePoint at same location but represented on space coords.
  //
  // Implementation note:
  //   We already have coord. transf. from the current plane to the space:
  //     plane._T
  var xySpace = this._T.transform(this.xy)
  var spaceMock = { '_T': nudged.Transform.IDENTITY }
  return new SpacePoint(spaceMock, xySpace)
}
github taataa / tapspace / examples / canvas / app.js View on Github external
var Model = function () {
      Emitter(this)

  // For ongoing transformation, remember where the pointers started from
  // and keep track where they are now. We store this information to
  // the pointers variable. It has a property for each current pointer.
  //
  // Example:
  // {
  //   'pointerid': {dx: , dy: , rx: , ry}
  // }
      var pointers = {}
      var numPointers = 0

  // Cumulated transformation. Like a history.
      var committedTransform = nudged.Transform.IDENTITY
  // When the history is combined with the ongoing transformation,
  // the result is total transformation.
      var totalTransform = nudged.Transform.IDENTITY

  // Limit the frequency of fired events
  // TODO should be done outside of the Model.
      var previousMoveDateNow = Date.now()

      var commit = function () {
    // Move ongoint transformation to the committed transformation so that
    // the total transformation stays the same.

    // Commit ongoingTransformation. As a result
    // the domain and range of all pointers become equal.
        var id, p, domain, range, t
        domain = []
github taataa / tapspace / examples / play / src / Model.js View on Github external
var Model = function () {
  Emitter(this)

  // For ongoing transformation, remember where the pointers started from
  // and keep track where they are now. We store this information to
  // the pointers variable. It has a property for each current pointer.
  //
  // Example:
  // {
  //   'pointerid': {dx: , dy: , rx: , ry}
  // }
  var pointers = {}
  var numPointers = 0

  // Cumulated transformation. Like a history.
  var committedTransform = nudged.Transform.IDENTITY
  // When the history is combined with the ongoing transformation,
  // the result is total transformation.
  var totalTransform = nudged.Transform.IDENTITY

  // Limit the frequency of fired events
  // TODO should be done outside of the Model.
  var previousMoveDateNow = Date.now()

  var commit = function () {
    // Move ongoint transformation to the committed transformation so that
    // the total transformation stays the same.

    // Commit ongoingTransformation. As a result
    // the domain and range of all pointers become equal.
    var id, p, domain, range, t
    domain = []
github taataa / tapspace / src / Transform.js View on Github external
// API v3.0.0

var nudged = require('nudged');

module.exports = nudged.Transform;
github taataa / tapspace / lib / geom / Transform.js View on Github external
var nudged = require('nudged')

module.exports = nudged.Transform

nudged

Affine transformation estimator e.g. for multi-touch gestures and calibration

MIT
Latest version published 5 days ago

Package Health Score

73 / 100
Full package analysis