Created
November 10, 2014 16:36
-
-
Save drart/c3f06bcfdca8b13d37f5 to your computer and use it in GitHub Desktop.
Simple Verold + jQuery example component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var $ = require('jquery'); | |
function Component() { | |
this.shouldrotate = false; | |
} | |
Component.prototype = new VAPI.VeroldComponent(); | |
/** | |
* Called as soon as the VeroldEntity begins to load. | |
*/ | |
Component.prototype.init = function() { | |
var that = this; | |
$("#home").hover( | |
function(){ that.shouldrotate = true; }, // hover over | |
function(){ that.shouldrotate = false; } // hover off | |
); | |
}; | |
Component.prototype.objectCreated = function() { | |
// this.getThreeData() is available | |
}; | |
Component.prototype.update = function(delta) { | |
var threeData; | |
if (this.hasThreeData()) { | |
// It is safe to manipulate threeData now. | |
threeData = this.getThreeData(); | |
if(this.shouldrotate) | |
{ | |
threeData.rotation.y += 0.1; | |
} | |
} | |
}; | |
Component.prototype.shutdown = function() { | |
}; | |
return Component; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment