Skip to content

Instantly share code, notes, and snippets.

class JTTrueSizeSurface
@DEFAULT_OPTIONS = {}
JTTrueSizeSurface.prototype = Object.create(Surface.prototype)
JTTrueSizeSurface.prototype.constructor = JTTrueSizeSurface
constructor: (id) ->
@id = id
Surface.apply(this, arguments)
@size = this.getSize()
@john45traver
john45traver / scrollToPosition
Created May 12, 2014 23:46
Scrolls scrollview to position
var scrollToPosition = function (finalPos, transition) {
var lastPos = scroller.getPosition();
var transitionable = new Transitionable(lastPos);
var prerender = function () {
scroller.setVelocity(0);
scroller.setPosition(transitionable.get());
};
@john45traver
john45traver / Scroll Container
Created May 17, 2014 02:43
Container on scroll
var Engine = require("famous/core/Engine");
var Surface = require("famous/core/Surface");
var Scrollview = require("famous/views/Scrollview");
var ContainerSurface = require('famous/surfaces/ContainerSurface');
var mainContext = Engine.createContext();
var scrollview = new Scrollview();
@john45traver
john45traver / scrollFromBottom
Created May 17, 2014 03:22
Scrollview from Bottom
var Engine = require("famous/core/Engine");
var Surface = require("famous/core/Surface");
var Scrollview = require("famous/views/Scrollview");
var Transform = require("famous/core/Transform");
var ContainerSurface = require('famous/surfaces/ContainerSurface');
var mainContext = Engine.createContext();
var scrollview = new Scrollview({
@john45traver
john45traver / fluid.js
Last active January 4, 2016 11:43
Simple Fluid Simulation with Famo.us
// Note: Edit to Force.js
// The Engine sends applyForce a list of bodies, even when a single body is attached
// eg..
// engine.attach(gravity,body)
// DOES NOT WORK
// applyForce to work with the current physics engine must be defined as follows:
//
// Force.prototype.applyForce = function applyForce(bodies) {
// for (var i = 0; i < bodies.length; i++) {
/*global module:false*/
/*Generated initially from grunt-init, heavily inspired by yo webapp*/
module.exports = function(grunt) {
'use strict';
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);
@john45traver
john45traver / contentElement.js
Created May 27, 2014 22:20
Passing Element to content
var Engine = require("famous/core/Engine");
var Surface = require("famous/core/Surface");
var mainContext = Engine.createContext();
content = document.createElement('p')
content.innerHTML = "Hello"
content.onclick = function(){console.log("Hello!")}
@john45traver
john45traver / rearrangeable.js.coffee
Created June 10, 2014 20:44
Rearrangeable Grid Coffeescript
Engine = require 'famous/core/Engine'
Surface = require 'famous/core/Surface'
View = require 'famous/core/View'
Transform = require 'famous/core/Transform'
RenderNode = require 'famous/core/RenderNode'
StateModifier = require 'famous/modifiers/StateModifier'
Easing = require 'famous/transitions/Easing'
Transitionable = require 'famous/transitions/Transitionable'
SpringTransition = require 'famous/transitions/SpringTransition'
WallTransition = require 'famous/transitions/WallTransition'
@john45traver
john45traver / infinite.js
Created June 12, 2014 04:48
Infinite Scrolling Panorama with Famo.us
define(function(require, exports, module) {
var Engine = require('famous/core/Engine');
var Surface = require('famous/core/Surface');
var Scrollview = require('famous/views/Scrollview');
var SequentialLayout = require('famous/views/SequentialLayout');
var context = Engine.createContext();
@john45traver
john45traver / rotation.js
Created June 17, 2014 21:47
Rotate Many Times
var Engine = require("famous/core/Engine");
var Surface = require("famous/core/Surface");
var Modifier = require('famous/core/Modifier');
var Transform = require('famous/core/Transform');
var Easing = require('famous/transitions/Easing');
var Transitionable = require('famous/transitions/Transitionable');
var mainContext = Engine.createContext();