Skip to content

Instantly share code, notes, and snippets.

@pavelvasev
Last active February 26, 2021 21:24
Show Gist options
  • Save pavelvasev/b3fdf752c76592f506393d4cf02dbb0c to your computer and use it in GitHub Desktop.
Save pavelvasev/b3fdf752c76592f506393d4cf02dbb0c to your computer and use it in GitHub Desktop.
// this is Viewzavr component/app, generated at Sat Feb 27 2021 02:23:44 GMT+0500 (Yekaterinburg Standard Time)
export function setup( vz ) {
vz.addItemType( "js-694","My js-694", function( opts ) {
return create( vz, opts );
} );
}
export function create( vz,opts ) {
var obj = vz.createObjByType( Object.assign( {},opts,{type: "js-code"}) );
// ******************** code
// object obj
obj.setParam( 'code', ` var pts = vz.vis.addPoints( obj );
pts.color = [1,0,1];
obj.trackParam("input",function() {
var v = obj.getParam("input");
pts.positions = v;
});
obj.setParam("input",[0,0,0, 2,1,5, 3,4,7 ]);
obj.setParamOption("input","internal",true );
` );
// object obj
var obj_obj = obj.ns.getChildByName('obj');
// object points
var obj_obj_points = obj_obj.ns.getChildByName('points');
obj_obj_points.setParam( 'radius', 56 );
obj_obj_points.setParam( 'color', 255 );
obj_obj_points.setParam( 'opacity', 56 );
obj_obj_points.setParam( 'depth-test', 1 );
obj_obj_points.setParam( 'shape', 3 );
// object link
var obj_obj_points_link = vz.create_obj_by_type( { type: 'link', parent: obj_obj_points, name: 'link' } );
obj_obj_points_link.setParam( 'enabled', true );
obj_obj_points_link.setParam( 'transform-code', `// enter transform code here. arg: v - input value
return v` );
obj_obj_points_link.setParam( 'to', "/js-code/obj/points->opacity" );
obj_obj_points_link.setParam( 'from', "/->r" );
obj_obj_points_link.setParam( 'tied_to_parent', true );
obj_obj_points_link.setParam( 'transform-enabled', true );
return obj;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment