Best JavaScript code snippet using storybook-root
threex-armultimarkerlearning.js
Source:threex-armultimarkerlearning.js
1var ARjs = ARjs || {}2var THREEx = THREEx || {}3ARjs.MarkersAreaLearning = THREEx.ArMultiMakersLearning = function(arToolkitContext, subMarkersControls){4 var _this = this5 this._arToolkitContext = arToolkitContext6 // Init variables7 this.subMarkersControls = subMarkersControls8 this.enabled = true9 10 // listen to arToolkitContext event 'sourceProcessed'11 // - after we fully processed one image, aka when we know all detected poses in it12 arToolkitContext.addEventListener('sourceProcessed', function(){13 _this._onSourceProcessed()14 })15}16//////////////////////////////////////////////////////////////////////////////17// statistic collection18//////////////////////////////////////////////////////////////////////////////19/**20 * What to do when a image source is fully processed21 */22ARjs.MarkersAreaLearning.prototype._onSourceProcessed = function(){23 var originQuaternion = this.subMarkersControls[0].object3d.quaternion24 // here collect the statistic on relative positioning 25 26 // honor this.enabled27 if( this.enabled === false ) return28 // keep only the visible markers29 var visibleMarkerControls = this.subMarkersControls.filter(function(markerControls){30 return markerControls.object3d.visible === true31 })32 var count = Object.keys(visibleMarkerControls).length33 var positionDelta = new THREE.Vector3()34 var quaternionDelta = new THREE.Quaternion()35 var scaleDelta = new THREE.Vector3()36 var tmpMatrix = new THREE.Matrix4()37 38 // go thru all the visibleMarkerControls39 for(var i = 0; i < count; i++){40 var markerControls1 = visibleMarkerControls[i]41 for(var j = 0; j < count; j++){42 var markerControls2 = visibleMarkerControls[j]43 // if markerControls1 is markerControls2, then skip it44 if( i === j ) continue45 //////////////////////////////////////////////////////////////////////////////46 // create data in markerControls1.object3d.userData if needed47 //////////////////////////////////////////////////////////////////////////////48 // create seenCouples for markerControls1 if needed49 if( markerControls1.object3d.userData.seenCouples === undefined ){50 markerControls1.object3d.userData.seenCouples = {}51 }52 var seenCouples = markerControls1.object3d.userData.seenCouples53 // create the multiMarkerPosition average if needed`54 if( seenCouples[markerControls2.id] === undefined ){55 // console.log('create seenCouples between', markerControls1.id, 'and', markerControls2.id)56 seenCouples[markerControls2.id] = {57 count : 0,58 position : {59 sum: new THREE.Vector3(0,0,0),60 average: new THREE.Vector3(0,0,0), 61 },62 quaternion : {63 sum: new THREE.Quaternion(0,0,0,0),64 average: new THREE.Quaternion(0,0,0,0), 65 },66 scale : {67 sum: new THREE.Vector3(0,0,0),68 average: new THREE.Vector3(0,0,0), 69 },70 }71 }72 73 //////////////////////////////////////////////////////////////////////////////74 // Compute markerControls2 position relative to markerControls175 //////////////////////////////////////////////////////////////////////////////76 77 // compute markerControls2 position/quaternion/scale in relation with markerControls178 tmpMatrix.getInverse(markerControls1.object3d.matrix)79 tmpMatrix.multiply(markerControls2.object3d.matrix)80 tmpMatrix.decompose(positionDelta, quaternionDelta, scaleDelta)81 82 //////////////////////////////////////////////////////////////////////////////83 // update statistics84 //////////////////////////////////////////////////////////////////////////////85 var stats = seenCouples[markerControls2.id]86 // update the count87 stats.count++88 // update the average of position/rotation/scale89 THREEx.ArMultiMarkerControls.averageVector3(stats.position.sum, positionDelta, stats.count, stats.position.average)90 THREEx.ArMultiMarkerControls.averageQuaternion(stats.quaternion.sum, quaternionDelta, originQuaternion, stats.count, stats.quaternion.average)91 THREEx.ArMultiMarkerControls.averageVector3(stats.scale.sum, scaleDelta, stats.count, stats.scale.average)92 }93 }94}95//////////////////////////////////////////////////////////////////////////////96// Compute markers transformation matrix from current stats97//////////////////////////////////////////////////////////////////////////////98ARjs.MarkersAreaLearning.prototype.computeResult = function(){99 var _this = this100 var originSubControls = this.subMarkersControls[0]101 this.deleteResult()102 // special case of originSubControls averageMatrix103 originSubControls.object3d.userData.result = {104 averageMatrix : new THREE.Matrix4(),105 confidenceFactor: 1,106 }107 // TODO here check if the originSubControls has been seen at least once!!108 109 110 /**111 * ALGO in pseudo code112 *113 * - Set confidenceFactor of origin sub markers as 1114 *115 * Start Looping116 * - For a given sub marker, skip it if it already has a result.117 * - if no result, check all seen couple and find n ones which has a progress of 1 or more.118 * - So the other seen sub markers, got a valid transformation matrix. 119 * - So take local averages position/orientation/scale, compose a transformation matrix. 120 * - aka transformation matrix from parent matrix * transf matrix pos/orientation/scale121 * - Multiple it by the other seen marker matrix. 122 * - Loop on the array until one pass could not compute any new sub marker123 */124 125 do{126 var resultChanged = false127 // loop over each subMarkerControls128 this.subMarkersControls.forEach(function(subMarkerControls){129 // if subMarkerControls already has a result, do nothing130 var result = subMarkerControls.object3d.userData.result131 var isLearned = (result !== undefined && result.confidenceFactor >= 1) ? true : false132 if( isLearned === true ) return133 134 // console.log('compute subMarkerControls', subMarkerControls.name())135 var otherSubControlsID = _this._getLearnedCoupleStats(subMarkerControls)136 if( otherSubControlsID === null ){137 // console.log('no learnedCoupleStats')138 return139 }140 141 var otherSubControls = _this._getSubMarkerControlsByID(otherSubControlsID)142 var seenCoupleStats = subMarkerControls.object3d.userData.seenCouples[otherSubControlsID]143 144 var averageMatrix = new THREE.Matrix4()145 averageMatrix.compose(seenCoupleStats.position.average, seenCoupleStats.quaternion.average, seenCoupleStats.scale.average)146 147 var otherAverageMatrix = otherSubControls.object3d.userData.result.averageMatrix148 var matrix = new THREE.Matrix4().getInverse(otherAverageMatrix).multiply(averageMatrix)149 matrix = new THREE.Matrix4().getInverse(matrix)150 console.assert( subMarkerControls.object3d.userData.result === undefined )151 subMarkerControls.object3d.userData.result = {152 averageMatrix: matrix,153 confidenceFactor: 1154 }155 156 resultChanged = true157 })158 // console.log('loop')159 }while(resultChanged === true)160 161 // debugger162 // console.log('json:', this.toJSON())163 // this.subMarkersControls.forEach(function(subMarkerControls){164 // var hasResult = subMarkerControls.object3d.userData.result !== undefined165 // console.log('marker', subMarkerControls.name(), hasResult ? 'has' : 'has NO', 'result')166 // })167}168//////////////////////////////////////////////////////////////////////////////169// Utility function170//////////////////////////////////////////////////////////////////////////////171/** 172 * get a _this.subMarkersControls id based on markerControls.id173 */174ARjs.MarkersAreaLearning.prototype._getLearnedCoupleStats = function(subMarkerControls){175 // if this subMarkerControls has never been seen with another subMarkerControls176 if( subMarkerControls.object3d.userData.seenCouples === undefined ) return null177 178 var seenCouples = subMarkerControls.object3d.userData.seenCouples179 var coupleControlsIDs = Object.keys(seenCouples).map(Number)180 for(var i = 0; i < coupleControlsIDs.length; i++){181 var otherSubControlsID = coupleControlsIDs[i]182 // get otherSubControls183 var otherSubControls = this._getSubMarkerControlsByID(otherSubControlsID)184 185 // if otherSubControls isnt learned, skip it186 var result = otherSubControls.object3d.userData.result187 var isLearned = (result !== undefined && result.confidenceFactor >= 1) ? true : false188 if( isLearned === false ) continue189 // return this seenCouplesStats190 return otherSubControlsID191 }192 193 // if none is found, return null194 return null195}196/** 197 * get a _this.subMarkersControls based on markerControls.id198 */199ARjs.MarkersAreaLearning.prototype._getSubMarkerControlsByID = function(controlsID){200 for(var i = 0; i < this.subMarkersControls.length; i++){201 var subMarkerControls = this.subMarkersControls[i]202 if( subMarkerControls.id === controlsID ){203 return subMarkerControls204 }205 }206 return null207}208 //////////////////////////////////////////////////////////////////////////////209// JSON file building210//////////////////////////////////////////////////////////////////////////////211ARjs.MarkersAreaLearning.prototype.toJSON = function(){212 // compute the average matrix before generating the file213 this.computeResult()214 //////////////////////////////////////////////////////////////////////////////215 // actually build the json216 //////////////////////////////////////////////////////////////////////////////217 var data = {218 meta : {219 createdBy : "Area Learning - AR.js "+THREEx.ArToolkitContext.REVISION,220 createdAt : new Date().toJSON(),221 222 },223 trackingBackend: this._arToolkitContext.parameters.trackingBackend,224 subMarkersControls : [],225 }226 var originSubControls = this.subMarkersControls[0]227 var originMatrixInverse = new THREE.Matrix4().getInverse(originSubControls.object3d.matrix)228 this.subMarkersControls.forEach(function(subMarkerControls, index){229 230 // if a subMarkerControls has no result, ignore it231 if( subMarkerControls.object3d.userData.result === undefined ) return232 var poseMatrix = subMarkerControls.object3d.userData.result.averageMatrix233 console.assert(poseMatrix instanceof THREE.Matrix4)234 235 // build the info236 var info = {237 parameters : {238 // to fill ...239 },240 poseMatrix : poseMatrix.toArray(),241 }242 if( subMarkerControls.parameters.type === 'pattern' ){243 info.parameters.type = subMarkerControls.parameters.type244 info.parameters.patternUrl = subMarkerControls.parameters.patternUrl245 }else if( subMarkerControls.parameters.type === 'barcode' ){246 info.parameters.type = subMarkerControls.parameters.type247 info.parameters.barcodeValue = subMarkerControls.parameters.barcodeValue248 }else console.assert(false)249 data.subMarkersControls.push(info)250 })251 var strJSON = JSON.stringify(data, null, '\t');252 253 254 //////////////////////////////////////////////////////////////////////////////255 // round matrix elements to ease readability - for debug256 //////////////////////////////////////////////////////////////////////////////257 var humanReadable = false258 if( humanReadable === true ){259 var tmp = JSON.parse(strJSON)260 tmp.subMarkersControls.forEach(function(markerControls){261 markerControls.poseMatrix = markerControls.poseMatrix.map(function(value){262 var roundingFactor = 100263 return Math.round(value*roundingFactor)/roundingFactor264 })265 })266 strJSON = JSON.stringify(tmp, null, '\t');267 }268 269 return strJSON; 270}271//////////////////////////////////////////////////////////////////////////////272// utility function273//////////////////////////////////////////////////////////////////////////////274/**275 * reset all collected statistics276 */277ARjs.MarkersAreaLearning.prototype.resetStats = function(){278 this.deleteResult()279 280 this.subMarkersControls.forEach(function(markerControls){281 delete markerControls.object3d.userData.seenCouples282 })283}284/**285 * reset all collected statistics286 */287ARjs.MarkersAreaLearning.prototype.deleteResult = function(){288 this.subMarkersControls.forEach(function(markerControls){289 delete markerControls.object3d.userData.result290 })...
hcalControls_8h.js
Source:hcalControls_8h.js
1var hcalControls_8h =2[3 [ "piMass", "da/d7d/hcalControls_8h.html#a698656f4c32092b7cddcde7891cce308", null ],4 [ "GAINS", "da/d7d/hcalControls_8h.html#a461c9576b505fa55b3301703dcfb6f0c", [5 [ "HIGH", "da/d7d/hcalControls_8h.html#a461c9576b505fa55b3301703dcfb6f0ca0c3a1dacf94061154b3ee354359c5893", null ],6 [ "LOW", "da/d7d/hcalControls_8h.html#a461c9576b505fa55b3301703dcfb6f0ca6a226f4143ca3b18999551694cdb72a8", null ]7 ] ],8 [ "OBJECTKINDS", "da/d7d/hcalControls_8h.html#af29635a2a940cf774ac109c9e567596a", [9 [ "CALOR", "da/d7d/hcalControls_8h.html#af29635a2a940cf774ac109c9e567596aaf6ee05a38245a4ff46da771691640d44", null ],10 [ "COUNTER", "da/d7d/hcalControls_8h.html#af29635a2a940cf774ac109c9e567596aa7b5e9804203d4b1300aad76e5f9a3302", null ]11 ] ],12 [ "STACKS", "da/d7d/hcalControls_8h.html#a6a9a0d67a2ddeeec18d0198f5454154d", [13 [ "EMC", "da/d7d/hcalControls_8h.html#a6a9a0d67a2ddeeec18d0198f5454154dac21206f76146b8913723119f609be907", null ],14 [ "HINNER", "da/d7d/hcalControls_8h.html#a6a9a0d67a2ddeeec18d0198f5454154dab8370375c9e144442657e5ea6ddf9b42", null ],15 [ "HOUTER", "da/d7d/hcalControls_8h.html#a6a9a0d67a2ddeeec18d0198f5454154da63cd14a304ec4cbe2ad7da8e4c93cb1f", null ],16 [ "HODO", "da/d7d/hcalControls_8h.html#a6a9a0d67a2ddeeec18d0198f5454154da9e6940bc4085e31de66e2f2378d31d09", null ],17 [ "SCINT", "da/d7d/hcalControls_8h.html#a6a9a0d67a2ddeeec18d0198f5454154da3c56511aba4874cdaa7b49e8519e5fb8", null ],18 [ "CHER", "da/d7d/hcalControls_8h.html#a6a9a0d67a2ddeeec18d0198f5454154da402fcaee34d62eb82523f87da6cd9e80", null ]19 ] ],20 [ "HLABdataDir", "da/d7d/hcalControls_8h.html#a643542592b5fdbcbec3b0569106942c5", null ],21 [ "HLABrootDir", "da/d7d/hcalControls_8h.html#a8998226eecfa3f1d2d1dcd3e8a7ff807", null ],22 [ "RCFdataDir", "da/d7d/hcalControls_8h.html#a34b93c191015766f5a2918f696d31a39", null ],23 [ "RCFrootDir", "da/d7d/hcalControls_8h.html#a6932c924ec292fd23d662555249874d5", null ],24 [ "ACTIVECHANNELS", "da/d7d/hcalControls_8h.html#a5231699a49aa005154a82c790621e1a7", null ],25 [ "CALSTACKS", "da/d7d/hcalControls_8h.html#a2b24f394b31bf0fccae03d221a07b817", null ],26 [ "CHANNELTHRESHOLDS", "da/d7d/hcalControls_8h.html#afb8a0f87b636587d36caa5d4f19c3a24", null ],27 [ "chinspected", "da/d7d/hcalControls_8h.html#a98c5de4ad7765163fd1d094c039e1551", null ],28 [ "chInUse", "da/d7d/hcalControls_8h.html#a9641ef2ef41b0978b1a53f512ddf27ae", null ],29 [ "CHTOTAL", "da/d7d/hcalControls_8h.html#a6a11296245bd18dc76d4b716d0546d74", null ],30 [ "counters", "da/d7d/hcalControls_8h.html#ae9bc5c8ce1de961dfaf84500c7a4802c", null ],31 [ "detchannels", "da/d7d/hcalControls_8h.html#aca79572b411df618635f82d13344e406", null ],32 [ "DISPLAYX", "da/d7d/hcalControls_8h.html#af597dbc9f9b17d381c7c1d1ab7cbd09f", null ],33 [ "emcCh", "da/d7d/hcalControls_8h.html#afd8826a7a394eda4904e19d046f4ce10", null ],34 [ "EMCCOLUMNS", "da/d7d/hcalControls_8h.html#a3a9f26c9d094c72492c5906ffaa00e24", null ],35 [ "EMCGAINS", "da/d7d/hcalControls_8h.html#a450a0610e434e6b55e98ca337c24f737", null ],36 [ "emcGainSelection", "da/d7d/hcalControls_8h.html#ad189b30c40980afc73bd2e68d95ecfbd", null ],37 [ "EMCROWS", "da/d7d/hcalControls_8h.html#a4ae3f913f0f1d2d2186011fe21fd5bca", null ],38 [ "EMCTOWERS", "da/d7d/hcalControls_8h.html#a48d2dba613b6856b5b93936197550a85", null ],39 [ "FALLTIME", "da/d7d/hcalControls_8h.html#a83c61aaab1b9df09d4c7f814a9dab31b", null ],40 [ "feech1", "da/d7d/hcalControls_8h.html#a4ffbf1b8a99f66e79b83e011d7b3d079", null ],41 [ "feech2", "da/d7d/hcalControls_8h.html#a8b8b9c6edba2b4292f631d94ccbc5f26", null ],42 [ "feechinsp", "da/d7d/hcalControls_8h.html#ac69ed59e0c9a05f8042865355d5a663e", null ],43 [ "HCALCOLUMNS", "da/d7d/hcalControls_8h.html#afdd6928d9aecd53d7464f0c084c2134e", null ],44 [ "HCALGAINS", "da/d7d/hcalControls_8h.html#a52ca0f2298153f07f593fc42d86100c1", null ],45 [ "hcalInnerCh", "da/d7d/hcalControls_8h.html#a8edb5dea893cc503481aa48f285c9fdc", null ],46 [ "hcalOuterCh", "da/d7d/hcalControls_8h.html#a311d8aa2cf1c0d6611ee7ab2b8099360", null ],47 [ "HCALROWS", "da/d7d/hcalControls_8h.html#a8252906532f6768ddd4e1c090fdcbea5", null ],48 [ "HCALTOWERS", "da/d7d/hcalControls_8h.html#a9280d8b145eb04cc1cbafd1c1fcbce30", null ],49 [ "hgDetChannels", "da/d7d/hcalControls_8h.html#a53f7fc667f7c06896cdbf52023b3b1b3", null ],50 [ "HITMULTTHRESHOLDS", "da/d7d/hcalControls_8h.html#a5145e9bb065b047f931dce2e9ded4419", null ],51 [ "HLGRATIO", "da/d7d/hcalControls_8h.html#a00f2b0b4935185afbc9d3484c59b64a9", null ],52 [ "hlgratios", "da/d7d/hcalControls_8h.html#ad52dce7d14459a9239ee9cc07e5d9941", null ],53 [ "hodoCh", "da/d7d/hcalControls_8h.html#a5f055789f5d8ddbd580ee40ca2c6dde0", null ],54 [ "lgDetChannels", "da/d7d/hcalControls_8h.html#a4037d0758805ed882db786a796b53bca", null ],55 [ "minProjEntries", "da/d7d/hcalControls_8h.html#ad746ed7bb30c7202751671f1cf199d5f", null ],56 [ "mu_779", "da/d7d/hcalControls_8h.html#aba78e8ac1eebd93bd07cadb15c1eb9bd", null ],57 [ "NPARAMETERS", "da/d7d/hcalControls_8h.html#af5c60ff87fc7a31294170deb7fa6cb70", null ],58 [ "NSAMPLES", "da/d7d/hcalControls_8h.html#a799c0adfc7047bb3abb403217547e8e5", null ],59 [ "ovrflow", "da/d7d/hcalControls_8h.html#a7f829577302bc9ad7d7610511df7dc61", null ],60 [ "PEDESTAL", "da/d7d/hcalControls_8h.html#a9e32f3596cb96d0759067a8020a5a134", null ],61 [ "READOUTCHANNELS", "da/d7d/hcalControls_8h.html#a811a5706ad85c0384898e1f0b7194ef5", null ],62 [ "RISETIME", "da/d7d/hcalControls_8h.html#a9a1f9faf2489d9836bf81bc6ac5c5112", null ],63 [ "sc_1061", "da/d7d/hcalControls_8h.html#a9767c322372066051f357ffa79216f5f", null ],64 [ "sc_1123", "da/d7d/hcalControls_8h.html#afa189ddd5de5f6d948cd05613cb15d6b", null ],65 [ "sc_779", "da/d7d/hcalControls_8h.html#a6094ea3e5954f571c3bfa7d2f8c4f781", null ],66 [ "sc_900", "da/d7d/hcalControls_8h.html#a35993e90dbcf814fde3b2c62169d3156", null ],67 [ "stAScale", "da/d7d/hcalControls_8h.html#aa9d87404f8812f5cd0c06d9648bb20c7", null ],68 [ "stECalib", "da/d7d/hcalControls_8h.html#af63aeb507f4cfb8e03ac1c1364802541", null ],69 [ "STHITMAX", "da/d7d/hcalControls_8h.html#acb908c30e117edc071642b02084970cf", null ],70 [ "STHITMIN", "da/d7d/hcalControls_8h.html#a8eb54f3ee4804f0d08382d2647195114", null ],71 [ "STTOTAMPTHR", "da/d7d/hcalControls_8h.html#aee141e89bed3e73f619b48ab0f0aa19a", null ],72 [ "STZEROSUPTHR", "da/d7d/hcalControls_8h.html#ac915a3e54b3763f6a61f738d6fa847e5", null ],73 [ "T1044HODO", "da/d7d/hcalControls_8h.html#a0b7e1c5d0abfa80bf6999b6521bcbfb4", null ],74 [ "T1044TRIGGERCH", "da/d7d/hcalControls_8h.html#adc65c9dc3f6cbe906c4d72fb7e785943", null ],75 [ "TILECHANNELS", "da/d7d/hcalControls_8h.html#a599ac724b46790106e50a7eeca8b9aac", null ],76 [ "TILEFIBERS", "da/d7d/hcalControls_8h.html#a440f8aa098fa8de0e3aab2a3d52532da", null ],77 [ "tileSizeX", "da/d7d/hcalControls_8h.html#a269bef42a6e2a64293a658f8d614a0e0", null ],78 [ "tileSizeY", "da/d7d/hcalControls_8h.html#adac1c004b6a6a0223cc93e098226c81f", null ],79 [ "TILETRIGGERCH", "da/d7d/hcalControls_8h.html#a44b7bb15a8e18508853ea5627fc26bba", null ],80 [ "trch1125", "da/d7d/hcalControls_8h.html#a57544b968b47d356f35f46164165a829", null ],81 [ "trch1152", "da/d7d/hcalControls_8h.html#acd3f361fea74a4932b3e39b2f63cdedf", null ],82 [ "TRGAINRANGE", "da/d7d/hcalControls_8h.html#a11375f427e53b34b0d73fe9917e4ba03", null ],83 [ "TRIGGERCHANNELS", "da/d7d/hcalControls_8h.html#ad5780d704f69a640f26057e14688ce66", null ],84 [ "triggerinsp", "da/d7d/hcalControls_8h.html#a9e6300fac22e1f2e54bcff4e0f726095", null ],85 [ "TRIGGERRES", "da/d7d/hcalControls_8h.html#a1dacf617353edaec7b81ddf9217faec1", null ],86 [ "TWRAMPTHR", "da/d7d/hcalControls_8h.html#a72f2249ae05b42060f69a054a49d22b0", null ],87 [ "TWRZEROSUPTHR", "da/d7d/hcalControls_8h.html#a246954b4a9e7a7303792f52c1fd79e67", null ],88 [ "undflow", "da/d7d/hcalControls_8h.html#a05fc55716e18349029ef0824bf243391", null ]...
BlendCharacterGui.js
Source:BlendCharacterGui.js
1/**2 * @author Michael Guerrero / http://realitymeltdown.com3 */4function BlendCharacterGui( blendMesh ) {5 var controls = {6 gui: null,7 "Show Model": true,8 "Show Skeleton": false,9 "Time Scale": 1.0,10 "Step Size": 0.016,11 "Crossfade Time": 3.5,12 "idle": 0.33,13 "walk": 0.33,14 "run": 0.3315 };16 var blendMesh = blendMesh;17 this.showModel = function() {18 return controls[ 'Show Model' ];19 };20 this.showSkeleton = function() {21 return controls[ 'Show Skeleton' ];22 };23 this.getTimeScale = function() {24 return controls[ 'Time Scale' ];25 };26 this.update = function( time ) {27 controls[ 'idle' ] = blendMesh.getWeight( 'idle' );28 controls[ 'walk' ] = blendMesh.getWeight( 'walk' );29 controls[ 'run' ] = blendMesh.getWeight( 'run' );30 };31 var init = function() {32 controls.gui = new dat.GUI();33 var settings = controls.gui.addFolder( 'Settings' );34 var playback = controls.gui.addFolder( 'Playback' );35 var blending = controls.gui.addFolder( 'Blend Tuning' );36 settings.add( controls, "Show Model" ).onChange( controls.showModelChanged );37 settings.add( controls, "Show Skeleton" ).onChange( controls.showSkeletonChanged );38 settings.add( controls, "Time Scale", 0, 1, 0.01 );39 settings.add( controls, "Step Size", 0.01, 0.1, 0.01 );40 settings.add( controls, "Crossfade Time", 0.1, 6.0, 0.05 );41 // These controls execute functions42 playback.add( controls, "start" );43 playback.add( controls, "pause" );44 playback.add( controls, "step" );45 playback.add( controls, "idle to walk" );46 playback.add( controls, "walk to run" );47 playback.add( controls, "warp walk to run" );48 blending.add( controls, "idle", 0, 1, 0.01 ).listen().onChange( controls.weight );49 blending.add( controls, "walk", 0, 1, 0.01 ).listen().onChange( controls.weight );50 blending.add( controls, "run", 0, 1, 0.01 ).listen().onChange( controls.weight );51 settings.open();52 playback.open();53 blending.open();54 };55 var getAnimationData = function() {56 return {57 detail: {58 anims: [ "idle", "walk", "run" ],59 weights: [ controls[ 'idle' ],60 controls[ 'walk' ],61 controls[ 'run' ] ]62 }63 };64 };65 controls.start = function() {66 var startEvent = new CustomEvent( 'start-animation', getAnimationData() );67 window.dispatchEvent( startEvent );68 };69 controls.stop = function() {70 var stopEvent = new CustomEvent( 'stop-animation' );71 window.dispatchEvent( stopEvent );72 };73 controls.pause = function() {74 var pauseEvent = new CustomEvent( 'pause-animation' );75 window.dispatchEvent( pauseEvent );76 };77 controls.step = function() {78 var stepData = { detail: { stepSize: controls[ 'Step Size' ] } };79 window.dispatchEvent( new CustomEvent( 'step-animation', stepData ) );80 };81 controls.weight = function() {82 // renormalize83 var sum = controls[ 'idle' ] + controls[ 'walk' ] + controls[ 'run' ];84 controls[ 'idle' ] /= sum;85 controls[ 'walk' ] /= sum;86 controls[ 'run' ] /= sum;87 var weightEvent = new CustomEvent( 'weight-animation', getAnimationData() );88 window.dispatchEvent( weightEvent );89 };90 controls.crossfade = function( from, to ) {91 var fadeData = getAnimationData();92 fadeData.detail.from = from;93 fadeData.detail.to = to;94 fadeData.detail.time = controls[ "Crossfade Time" ];95 window.dispatchEvent( new CustomEvent( 'crossfade', fadeData ) );96 };97 controls.warp = function( from, to ) {98 var warpData = getAnimationData();99 warpData.detail.from = 'walk';100 warpData.detail.to = 'run';101 warpData.detail.time = controls[ "Crossfade Time" ];102 window.dispatchEvent( new CustomEvent( 'warp', warpData ) );103 };104 controls[ 'idle to walk' ] = function() {105 controls.crossfade( 'idle', 'walk' );106 };107 controls[ 'walk to run' ] = function() {108 controls.crossfade( 'walk', 'run' );109 };110 controls[ 'warp walk to run' ] = function() {111 controls.warp( 'walk', 'run' );112 };113 controls.showSkeletonChanged = function() {114 var data = {115 detail: {116 shouldShow: controls[ 'Show Skeleton' ]117 }118 };119 window.dispatchEvent( new CustomEvent( 'toggle-show-skeleton', data ) );120 };121 controls.showModelChanged = function() {122 var data = {123 detail: {124 shouldShow: controls[ 'Show Model' ]125 }126 };127 window.dispatchEvent( new CustomEvent( 'toggle-show-model', data ) );128 };129 init.call( this );...
Using AI Code Generation
1import { setOptions } from 'storybook-addon-options';2setOptions({3});4import { setOptions } from 'storybook-addon-options';5setOptions({6});7MIT © [Rahul Kadyan](
Using AI Code Generation
1import { controls } from "storybook-root";2import { controls } from "storybook-root";3import { controls } from "storybook-root";4import { controls } from "storybook-root";5import { controls } from "storybook-root";6import { controls } from "storybook-root";7import { controls } from "storybook-root";8import { controls } from "storybook-root";9import { controls } from "storybook-root";10import { controls } from "storybook-root";11import { controls } from "storybook-root";12import { controls } from "storybook-root";13import { controls } from "storybook-root";14import { controls } from "storybook-root";15import { controls } from "storybook-root";16import { controls } from "storybook-root";17import { controls } from "storybook-root";18import { controls } from "storybook-root";19import { controls } from "storybook-root";20import { controls } from "storybook-root";21import { controls } from "storybook-root";22import { controls } from "storybook-root";
Using AI Code Generation
1import { configure } from '@storybook/react';2export function controls() {3 console.log('controls');4}5export function configureStorybook() {6 console.log('configureStorybook');7 configure(() => {8 console.log('configure');9 });10}11import { configureStorybook } from 'storybook-root';12configureStorybook();13import { controls } from 'storybook-root';14controls();15import { controls } from 'storybook-root';16controls();17import { controls } from 'storybook-root';18controls();19import { controls } from 'storybook-root';20controls();21import { controls } from 'storybook-root';22controls();23import { controls } from 'storybook-root';24controls();25import { controls } from 'storybook-root';26controls();
Using AI Code Generation
1const controls = require('storybook-root').controls;2const { storiesOf } = require('@storybook/react');3storiesOf('MyComponent', module)4 .add('simple', () => (5 {...controls}6 ));7const controls = {8 address: {9 }10};11module.exports = {12};13const controls = require('storybook-root').controls;14const { storiesOf } = require('@storybook/react');15storiesOf('MyComponent', module)16 .add('simple', () => (17 {...controls}18 ));19const controls = {20 address: {21 }22};23module.exports = {24};25const { storiesOf } = require('@storybook/react');26storiesOf('MyComponent', module)27 .add('simple', () => (28 {...require('storybook-root').controls}29 ));30const controls = {31 address: {
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!