8:00 – 5:00 SR
- DB backups
- Deploy new RQ – or at least most of it…
- Got the list of desired enhancements. Need to assign hours.
- JavaScript
- Threejs examples
- Work on making a YUI module that extends WebGLComponent – Done!
- Added three.js loading capability. Easy!
YUI({ groups:{ threejs:{ base: './libs/', async: false, modules: { 'threejs': { path: 'three.js' } } }, localModules:{ base: './BasicBaseElements/', modules: { 'WebGLCanvas': { path: 'WebGLCanvas/js/WebGLCanvas.js', skinnable: true }, 'WebGLComponent': { path: 'WebGLComponent/js/WebGLComponent.js', skinnable: false } } } } }).use('threejs', 'WebGLCanvas', 'WebGLComponent', 'panel', 'dd-plugin', function (Y) {...});
- Ok, now to inheritance
- To inherit in YUI, it looks like all you have to do(?) is to use Y.Base.create, and specify the component that you are extending. Here’s how it looks:
YUI.add('WebGLSphere', function (Y) { "use strict"; // handy constants and shortcuts used in the module var _LANG = Y.Lang; var _NAME = 'WebGLSphere'; // publish the global prototype Y.WebGLSphere = Y.Base.create( _NAME, // the name of this module (for debugging Y.WebGLComponent, // the class we are extending (can be Widget too) [], // any extensions that we want to properties or methods (e.g. ArrayList) // Instance members are the properties and methods that go into the class prototype, those that // each instance will get a copy and usually need to be references by 'this' { // prototype variables // prototype methods }, // Attributes - accessed through this.get('attrName') and this.set('attrName', value). // Note that we can do "type" checking here with validators { ATTRS: { myValue:{ value: 1.0 } } } ); }, '0.1', { requires: ['WebGLComponent'], skinnable: false });
In this case, the module I’m creating is Y.WebGLSphere. I am extending it from Y.WebGLComponent. In the code above, it does nothing. Next, I’m going to override the initModel function to create a sphere and the initializer to take a jpg to use as a texture.
You must be logged in to post a comment.