How to use finish method in Appium Xcuitest Driver

Best JavaScript code snippet using appium-xcuitest-driver

belt_Array.js

Source:belt_Array.js Github

copy

Full Screen

1'use strict';2var Curry = require("./curry.js");3var Js_math = require("./js_math.js");4var Caml_primitive = require("./caml_primitive.js");5function get(arr, i) {6 if (i >= 0 && i < arr.length) {7 return /* Some */[arr[i]];8 } else {9 return /* None */0;10 }11}12function getExn(arr, i) {13 if (!(i >= 0 && i < arr.length)) {14 throw new Error("File \"belt_Array.ml\", line 41, characters 6-12");15 }16 return arr[i];17}18function set(arr, i, v) {19 if (i >= 0 && i < arr.length) {20 arr[i] = v;21 return true;22 } else {23 return false;24 }25}26function setExn(arr, i, v) {27 if (!(i >= 0 && i < arr.length)) {28 throw new Error("File \"belt_Array.ml\", line 47, characters 4-10");29 }30 arr[i] = v;31 return /* () */0;32}33function swapUnsafe(xs, i, j) {34 var tmp = xs[i];35 xs[i] = xs[j];36 xs[j] = tmp;37 return /* () */0;38}39function shuffleInPlace(xs) {40 var len = xs.length;41 for(var i = 0 ,i_finish = len - 1 | 0; i <= i_finish; ++i){42 swapUnsafe(xs, i, Js_math.random_int(i, len));43 }44 return /* () */0;45}46function shuffle(xs) {47 var result = xs.slice(0);48 shuffleInPlace(result);49 return result;50}51function reverseInPlace(xs) {52 var len = xs.length;53 var xs$1 = xs;54 var ofs = 0;55 var len$1 = len;56 for(var i = 0 ,i_finish = (len$1 / 2 | 0) - 1 | 0; i <= i_finish; ++i){57 swapUnsafe(xs$1, ofs + i | 0, ((ofs + len$1 | 0) - i | 0) - 1 | 0);58 }59 return /* () */0;60}61function make(l, f) {62 if (l <= 0) {63 return /* array */[];64 } else {65 var res = new Array(l);66 for(var i = 0 ,i_finish = l - 1 | 0; i <= i_finish; ++i){67 res[i] = f;68 }69 return res;70 }71}72function reverse(xs) {73 var len = xs.length;74 var result = len > 0 ? new Array(len) : /* array */[];75 for(var i = 0 ,i_finish = len - 1 | 0; i <= i_finish; ++i){76 result[i] = xs[(len - 1 | 0) - i | 0];77 }78 return result;79}80function makeByU(l, f) {81 if (l <= 0) {82 return /* array */[];83 } else {84 var res = l > 0 ? (f(0), new Array(l)) : /* array */[];85 for(var i = 0 ,i_finish = l - 1 | 0; i <= i_finish; ++i){86 res[i] = f(i);87 }88 return res;89 }90}91function makeBy(l, f) {92 return makeByU(l, Curry.__1(f));93}94function makeByAndShuffleU(l, f) {95 var u = makeByU(l, f);96 shuffleInPlace(u);97 return u;98}99function makeByAndShuffle(l, f) {100 return makeByAndShuffleU(l, Curry.__1(f));101}102function range(start, finish) {103 var cut = finish - start | 0;104 if (cut < 0) {105 return /* array */[];106 } else {107 var arr = new Array(cut + 1 | 0);108 for(var i = 0; i <= cut; ++i){109 arr[i] = start + i | 0;110 }111 return arr;112 }113}114function rangeBy(start, finish, step) {115 var cut = finish - start | 0;116 if (cut < 0 || step <= 0) {117 return /* array */[];118 } else {119 var nb = (cut / step | 0) + 1 | 0;120 var arr = new Array(nb);121 var cur = start;122 for(var i = 0 ,i_finish = nb - 1 | 0; i <= i_finish; ++i){123 arr[i] = cur;124 cur = cur + step | 0;125 }126 return arr;127 }128}129function zip(xs, ys) {130 var lenx = xs.length;131 var leny = ys.length;132 var len = lenx < leny ? lenx : leny;133 var s = len > 0 ? new Array(len) : /* array */[];134 for(var i = 0 ,i_finish = len - 1 | 0; i <= i_finish; ++i){135 s[i] = /* tuple */[136 xs[i],137 ys[i]138 ];139 }140 return s;141}142function zipByU(xs, ys, f) {143 var lenx = xs.length;144 var leny = ys.length;145 var len = lenx < leny ? lenx : leny;146 var s = len > 0 ? (f(xs[0], ys[0]), new Array(len)) : /* array */[];147 for(var i = 0 ,i_finish = len - 1 | 0; i <= i_finish; ++i){148 s[i] = f(xs[i], ys[i]);149 }150 return s;151}152function zipBy(xs, ys, f) {153 return zipByU(xs, ys, Curry.__2(f));154}155function concat(a1, a2) {156 var l1 = a1.length;157 var l2 = a2.length;158 var a1a2 = l1 > 0 ? new Array(l1 + l2 | 0) : /* array */[];159 for(var i = 0 ,i_finish = l1 - 1 | 0; i <= i_finish; ++i){160 a1a2[i] = a1[i];161 }162 for(var i$1 = 0 ,i_finish$1 = l2 - 1 | 0; i$1 <= i_finish$1; ++i$1){163 a1a2[l1 + i$1 | 0] = a2[i$1];164 }165 return a1a2;166}167function concatMany(arrs) {168 var lenArrs = arrs.length;169 var totalLen = 0;170 var firstArrWithLengthMoreThanZero = /* None */0;171 for(var i = 0 ,i_finish = lenArrs - 1 | 0; i <= i_finish; ++i){172 var len = arrs[i].length;173 totalLen = totalLen + len | 0;174 if (len > 0 && firstArrWithLengthMoreThanZero === /* None */0) {175 firstArrWithLengthMoreThanZero = /* Some */[arrs[i]];176 }177 178 }179 var match = firstArrWithLengthMoreThanZero;180 if (match) {181 var result = new Array(totalLen);182 totalLen = 0;183 for(var j = 0 ,j_finish = lenArrs - 1 | 0; j <= j_finish; ++j){184 var cur = arrs[j];185 for(var k = 0 ,k_finish = cur.length - 1 | 0; k <= k_finish; ++k){186 result[totalLen] = cur[k];187 totalLen = totalLen + 1 | 0;188 }189 }190 return result;191 } else {192 return /* array */[];193 }194}195function slice(a, offset, len) {196 if (len <= 0) {197 return /* array */[];198 } else {199 var lena = a.length;200 var ofs = offset < 0 ? Caml_primitive.caml_int_max(lena + offset | 0, 0) : offset;201 var hasLen = lena - ofs | 0;202 var copyLength = hasLen < len ? hasLen : len;203 if (copyLength <= 0) {204 return /* array */[];205 } else {206 var result = lena > 0 ? new Array(copyLength) : /* array */[];207 for(var i = 0 ,i_finish = copyLength - 1 | 0; i <= i_finish; ++i){208 result[i] = a[ofs + i | 0];209 }210 return result;211 }212 }213}214function fill(a, offset, len, v) {215 if (len > 0) {216 var lena = a.length;217 var ofs = offset < 0 ? Caml_primitive.caml_int_max(lena + offset | 0, 0) : offset;218 var hasLen = lena - ofs | 0;219 var fillLength = hasLen < len ? hasLen : len;220 if (fillLength > 0) {221 for(var i = ofs ,i_finish = (ofs + fillLength | 0) - 1 | 0; i <= i_finish; ++i){222 a[i] = v;223 }224 return /* () */0;225 } else {226 return 0;227 }228 } else {229 return 0;230 }231}232function blitUnsafe(a1, srcofs1, a2, srcofs2, blitLength) {233 if (srcofs2 <= srcofs1) {234 for(var j = 0 ,j_finish = blitLength - 1 | 0; j <= j_finish; ++j){235 a2[j + srcofs2 | 0] = a1[j + srcofs1 | 0];236 }237 return /* () */0;238 } else {239 for(var j$1 = blitLength - 1 | 0; j$1 >= 0; --j$1){240 a2[j$1 + srcofs2 | 0] = a1[j$1 + srcofs1 | 0];241 }242 return /* () */0;243 }244}245function blit(a1, ofs1, a2, ofs2, len) {246 var lena1 = a1.length;247 var lena2 = a2.length;248 var srcofs1 = ofs1 < 0 ? Caml_primitive.caml_int_max(lena1 + ofs1 | 0, 0) : ofs1;249 var srcofs2 = ofs2 < 0 ? Caml_primitive.caml_int_max(lena2 + ofs2 | 0, 0) : ofs2;250 var blitLength = Caml_primitive.caml_int_min(len, Caml_primitive.caml_int_min(lena1 - srcofs1 | 0, lena2 - srcofs2 | 0));251 if (srcofs2 <= srcofs1) {252 for(var j = 0 ,j_finish = blitLength - 1 | 0; j <= j_finish; ++j){253 a2[j + srcofs2 | 0] = a1[j + srcofs1 | 0];254 }255 return /* () */0;256 } else {257 for(var j$1 = blitLength - 1 | 0; j$1 >= 0; --j$1){258 a2[j$1 + srcofs2 | 0] = a1[j$1 + srcofs1 | 0];259 }260 return /* () */0;261 }262}263function forEachU(a, f) {264 for(var i = 0 ,i_finish = a.length - 1 | 0; i <= i_finish; ++i){265 f(a[i]);266 }267 return /* () */0;268}269function forEach(a, f) {270 return forEachU(a, Curry.__1(f));271}272function mapU(a, f) {273 var l = a.length;274 var r = l > 0 ? (f(a[0]), new Array(l)) : /* array */[];275 for(var i = 0 ,i_finish = l - 1 | 0; i <= i_finish; ++i){276 r[i] = f(a[i]);277 }278 return r;279}280function map(a, f) {281 return mapU(a, Curry.__1(f));282}283function keepU(a, f) {284 var l = a.length;285 var r = l > 0 ? new Array(l) : /* array */[];286 var j = 0;287 for(var i = 0 ,i_finish = l - 1 | 0; i <= i_finish; ++i){288 var v = a[i];289 if (f(v)) {290 r[j] = v;291 j = j + 1 | 0;292 }293 294 }295 r.length = j;296 return r;297}298function keep(a, f) {299 return keepU(a, Curry.__1(f));300}301function keepMapU(a, f) {302 var l = a.length;303 var r = new Array(l);304 var j = 0;305 for(var i = 0 ,i_finish = l - 1 | 0; i <= i_finish; ++i){306 var v = a[i];307 var match = f(v);308 if (match) {309 r[j] = match[0];310 j = j + 1 | 0;311 }312 313 }314 r.length = j;315 return r;316}317function keepMap(a, f) {318 return keepMapU(a, Curry.__1(f));319}320function forEachWithIndexU(a, f) {321 for(var i = 0 ,i_finish = a.length - 1 | 0; i <= i_finish; ++i){322 f(i, a[i]);323 }324 return /* () */0;325}326function forEachWithIndex(a, f) {327 return forEachWithIndexU(a, Curry.__2(f));328}329function mapWithIndexU(a, f) {330 var l = a.length;331 var r = l > 0 ? (f(0, a[0]), new Array(l)) : /* array */[];332 for(var i = 0 ,i_finish = l - 1 | 0; i <= i_finish; ++i){333 r[i] = f(i, a[i]);334 }335 return r;336}337function mapWithIndex(a, f) {338 return mapWithIndexU(a, Curry.__2(f));339}340function reduceU(a, x, f) {341 var r = x;342 for(var i = 0 ,i_finish = a.length - 1 | 0; i <= i_finish; ++i){343 r = f(r, a[i]);344 }345 return r;346}347function reduce(a, x, f) {348 return reduceU(a, x, Curry.__2(f));349}350function reduceReverseU(a, x, f) {351 var r = x;352 for(var i = a.length - 1 | 0; i >= 0; --i){353 r = f(r, a[i]);354 }355 return r;356}357function reduceReverse(a, x, f) {358 return reduceReverseU(a, x, Curry.__2(f));359}360function reduceReverse2U(a, b, x, f) {361 var r = x;362 var len = Caml_primitive.caml_int_min(a.length, b.length);363 for(var i = len - 1 | 0; i >= 0; --i){364 r = f(r, a[i], b[i]);365 }366 return r;367}368function reduceReverse2(a, b, x, f) {369 return reduceReverse2U(a, b, x, Curry.__3(f));370}371function everyU(arr, b) {372 var len = arr.length;373 var arr$1 = arr;374 var _i = 0;375 var b$1 = b;376 var len$1 = len;377 while(true) {378 var i = _i;379 if (i === len$1) {380 return true;381 } else if (b$1(arr$1[i])) {382 _i = i + 1 | 0;383 continue ;384 } else {385 return false;386 }387 };388}389function every(arr, f) {390 return everyU(arr, Curry.__1(f));391}392function someU(arr, b) {393 var len = arr.length;394 var arr$1 = arr;395 var _i = 0;396 var b$1 = b;397 var len$1 = len;398 while(true) {399 var i = _i;400 if (i === len$1) {401 return false;402 } else if (b$1(arr$1[i])) {403 return true;404 } else {405 _i = i + 1 | 0;406 continue ;407 }408 };409}410function some(arr, f) {411 return someU(arr, Curry.__1(f));412}413function everyAux2(arr1, arr2, _i, b, len) {414 while(true) {415 var i = _i;416 if (i === len) {417 return true;418 } else if (b(arr1[i], arr2[i])) {419 _i = i + 1 | 0;420 continue ;421 } else {422 return false;423 }424 };425}426function every2U(a, b, p) {427 return everyAux2(a, b, 0, p, Caml_primitive.caml_int_min(a.length, b.length));428}429function every2(a, b, p) {430 return every2U(a, b, Curry.__2(p));431}432function some2U(a, b, p) {433 var arr1 = a;434 var arr2 = b;435 var _i = 0;436 var b$1 = p;437 var len = Caml_primitive.caml_int_min(a.length, b.length);438 while(true) {439 var i = _i;440 if (i === len) {441 return false;442 } else if (b$1(arr1[i], arr2[i])) {443 return true;444 } else {445 _i = i + 1 | 0;446 continue ;447 }448 };449}450function some2(a, b, p) {451 return some2U(a, b, Curry.__2(p));452}453function eqU(a, b, p) {454 var lena = a.length;455 var lenb = b.length;456 if (lena === lenb) {457 return everyAux2(a, b, 0, p, lena);458 } else {459 return false;460 }461}462function eq(a, b, p) {463 return eqU(a, b, Curry.__2(p));464}465function cmpU(a, b, p) {466 var lena = a.length;467 var lenb = b.length;468 if (lena > lenb) {469 return 1;470 } else if (lena < lenb) {471 return -1;472 } else {473 var arr1 = a;474 var arr2 = b;475 var _i = 0;476 var b$1 = p;477 var len = lena;478 while(true) {479 var i = _i;480 if (i === len) {481 return 0;482 } else {483 var c = b$1(arr1[i], arr2[i]);484 if (c === 0) {485 _i = i + 1 | 0;486 continue ;487 } else {488 return c;489 }490 }491 };492 }493}494function cmp(a, b, p) {495 return cmpU(a, b, Curry.__2(p));496}497function partitionU(a, f) {498 var l = a.length;499 var i = 0;500 var j = 0;501 var a1 = l > 0 ? new Array(l) : /* array */[];502 var a2 = l > 0 ? new Array(l) : /* array */[];503 for(var ii = 0 ,ii_finish = l - 1 | 0; ii <= ii_finish; ++ii){504 var v = a[ii];505 if (f(v)) {506 a1[i] = v;507 i = i + 1 | 0;508 } else {509 a2[j] = v;510 j = j + 1 | 0;511 }512 }513 a1.length = i;514 a2.length = j;515 return /* tuple */[516 a1,517 a2518 ];519}520function partition(a, f) {521 return partitionU(a, Curry.__1(f));522}523function unzip(a) {524 var l = a.length;525 var match;526 if (l > 0) {527 match = /* tuple */[528 new Array(l),529 new Array(l)530 ];531 } else {532 match = /* tuple */[533 /* array */[],534 /* array */[]535 ];536 }537 var a2 = match[1];538 var a1 = match[0];539 for(var i = 0 ,i_finish = l - 1 | 0; i <= i_finish; ++i){540 var match$1 = a[i];541 a1[i] = match$1[0];542 a2[i] = match$1[1];543 }544 return /* tuple */[545 a1,546 a2547 ];548}549exports.get = get;550exports.getExn = getExn;551exports.set = set;552exports.setExn = setExn;553exports.shuffleInPlace = shuffleInPlace;554exports.shuffle = shuffle;555exports.reverseInPlace = reverseInPlace;556exports.reverse = reverse;557exports.make = make;558exports.range = range;559exports.rangeBy = rangeBy;560exports.makeByU = makeByU;561exports.makeBy = makeBy;562exports.makeByAndShuffleU = makeByAndShuffleU;563exports.makeByAndShuffle = makeByAndShuffle;564exports.zip = zip;565exports.zipByU = zipByU;566exports.zipBy = zipBy;567exports.unzip = unzip;568exports.concat = concat;569exports.concatMany = concatMany;570exports.slice = slice;571exports.fill = fill;572exports.blit = blit;573exports.blitUnsafe = blitUnsafe;574exports.forEachU = forEachU;575exports.forEach = forEach;576exports.mapU = mapU;577exports.map = map;578exports.keepU = keepU;579exports.keep = keep;580exports.keepMapU = keepMapU;581exports.keepMap = keepMap;582exports.forEachWithIndexU = forEachWithIndexU;583exports.forEachWithIndex = forEachWithIndex;584exports.mapWithIndexU = mapWithIndexU;585exports.mapWithIndex = mapWithIndex;586exports.partitionU = partitionU;587exports.partition = partition;588exports.reduceU = reduceU;589exports.reduce = reduce;590exports.reduceReverseU = reduceReverseU;591exports.reduceReverse = reduceReverse;592exports.reduceReverse2U = reduceReverse2U;593exports.reduceReverse2 = reduceReverse2;594exports.someU = someU;595exports.some = some;596exports.everyU = everyU;597exports.every = every;598exports.every2U = every2U;599exports.every2 = every2;600exports.some2U = some2U;601exports.some2 = some2;602exports.cmpU = cmpU;603exports.cmp = cmp;604exports.eqU = eqU;605exports.eq = eq;...

Full Screen

Full Screen

lighting.js.consoleStripped.js

Source:lighting.js.consoleStripped.js Github

copy

Full Screen

1define("dojox/gfx3d/lighting", [2 "dojo/_base/lang",3 "dojo/_base/Color", // dojo.Color4 "dojo/_base/declare", // declare5 "dojox/gfx/_base",6 "./_base"7],function(lang,Color,declare,gfx,gfx3d) {8 var lite = gfx3d.lighting = {9 // color utilities10 black: function(){11 return {r: 0, g: 0, b: 0, a: 1};12 },13 white: function(){14 return {r: 1, g: 1, b: 1, a: 1};15 },16 toStdColor: function(c){17 c = gfx.normalizeColor(c);18 return {r: c.r / 255, g: c.g / 255, b: c.b / 255, a: c.a};19 },20 fromStdColor: function(c){21 return new Color([Math.round(255 * c.r), Math.round(255 * c.g), Math.round(255 * c.b), c.a]);22 },23 scaleColor: function(s, c){24 return {r: s * c.r, g: s * c.g, b: s * c.b, a: s * c.a};25 },26 addColor: function(a, b){27 return {r: a.r + b.r, g: a.g + b.g, b: a.b + b.b, a: a.a + b.a};28 },29 multiplyColor: function(a, b){30 return {r: a.r * b.r, g: a.g * b.g, b: a.b * b.b, a: a.a * b.a};31 },32 saturateColor: function(c){33 return {34 r: c.r < 0 ? 0 : c.r > 1 ? 1 : c.r,35 g: c.g < 0 ? 0 : c.g > 1 ? 1 : c.g,36 b: c.b < 0 ? 0 : c.b > 1 ? 1 : c.b,37 a: c.a < 0 ? 0 : c.a > 1 ? 1 : c.a38 };39 },40 mixColor: function(c1, c2, s){41 return lite.addColor(lite.scaleColor(s, c1), lite.scaleColor(1 - s, c2));42 },43 diff2Color: function(c1, c2){44 var r = c1.r - c2.r;45 var g = c1.g - c2.g;46 var b = c1.b - c2.b;47 var a = c1.a - c2.a;48 return r * r + g * g + b * b + a * a;49 },50 length2Color: function(c){51 return c.r * c.r + c.g * c.g + c.b * c.b + c.a * c.a;52 },53 54 // vector utilities55 //TODO: move vector utilities from this file to vector.js56 dot: function(a, b){57 return a.x * b.x + a.y * b.y + a.z * b.z;58 },59 scale: function(s, v){60 return {x: s * v.x, y: s * v.y, z: s * v.z};61 },62 add: function(a, b){63 return {x: a.x + b.x, y: a.y + b.y, z: a.z + b.z};64 },65 saturate: function(v){66 return Math.min(Math.max(v, 0), 1);67 },68 length: function(v){69 return Math.sqrt(gfx3d.lighting.dot(v, v));70 },71 normalize: function(v){72 return lite.scale(1 / lite.length(v), v);73 },74 faceforward: function(n, i){75 var p = gfx3d.lighting;76 var s = p.dot(i, n) < 0 ? 1 : -1;77 return p.scale(s, n);78 },79 reflect: function(i, n){80 var p = gfx3d.lighting;81 return p.add(i, p.scale(-2 * p.dot(i, n), n));82 },83 84 // lighting utilities85 diffuse: function(normal, lights){86 var c = lite.black();87 for(var i = 0; i < lights.length; ++i){88 var l = lights[i],89 d = lite.dot(lite.normalize(l.direction), normal);90 c = lite.addColor(c, lite.scaleColor(d, l.color));91 }92 return lite.saturateColor(c);93 },94 specular: function(normal, v, roughness, lights){95 var c = lite.black();96 for(var i = 0; i < lights.length; ++i){97 var l = lights[i],98 h = lite.normalize(lite.add(lite.normalize(l.direction), v)),99 s = Math.pow(Math.max(0, lite.dot(normal, h)), 1 / roughness);100 c = lite.addColor(c, lite.scaleColor(s, l.color));101 }102 return lite.saturateColor(c);103 },104 phong: function(normal, v, size, lights){105 normal = lite.normalize(normal);106 var c = lite.black();107 for(var i = 0; i < lights.length; ++i){108 var l = lights[i],109 r = lite.reflect(lite.scale(-1, lite.normalize(v)), normal),110 s = Math.pow(Math.max(0, lite.dot(r, lite.normalize(l.direction))), size);111 c = lite.addColor(c, lite.scaleColor(s, l.color));112 }113 return lite.saturateColor(c);114 }115 };116 // this lighting model is derived from RenderMan Interface Specification Version 3.2117 declare("dojox.gfx3d.lighting.Model", null, {118 constructor: function(incident, lights, ambient, specular){119 this.incident = lite.normalize(incident);120 this.lights = [];121 for(var i = 0; i < lights.length; ++i){122 var l = lights[i];123 this.lights.push({direction: lite.normalize(l.direction), color: lite.toStdColor(l.color)});124 }125 this.ambient = lite.toStdColor(ambient.color ? ambient.color : "white");126 this.ambient = lite.scaleColor(ambient.intensity, this.ambient);127 this.ambient = lite.scaleColor(this.ambient.a, this.ambient);128 this.ambient.a = 1;129 this.specular = lite.toStdColor(specular ? specular : "white");130 this.specular = lite.scaleColor(this.specular.a, this.specular);131 this.specular.a = 1;132 this.npr_cool = {r: 0, g: 0, b: 0.4, a: 1};133 this.npr_warm = {r: 0.4, g: 0.4, b: 0.2, a: 1};134 this.npr_alpha = 0.2;135 this.npr_beta = 0.6;136 this.npr_scale = 0.6;137 },138 constant: function(normal, finish, pigment){139 pigment = lite.toStdColor(pigment);140 var alpha = pigment.a, color = lite.scaleColor(alpha, pigment);141 color.a = alpha;142 return lite.fromStdColor(lite.saturateColor(color));143 },144 matte: function(normal, finish, pigment){145 if(typeof finish == "string"){ finish = lite.finish[finish]; }146 pigment = lite.toStdColor(pigment);147 normal = lite.faceforward(lite.normalize(normal), this.incident);148 var ambient = lite.scaleColor(finish.Ka, this.ambient),149 shadow = lite.saturate(-4 * lite.dot(normal, this.incident)),150 diffuse = lite.scaleColor(shadow * finish.Kd, lite.diffuse(normal, this.lights)),151 color = lite.scaleColor(pigment.a, lite.multiplyColor(pigment, lite.addColor(ambient, diffuse)));152 color.a = pigment.a;153 return lite.fromStdColor(lite.saturateColor(color));154 },155 metal: function(normal, finish, pigment){156 if(typeof finish == "string"){ finish = lite.finish[finish]; }157 pigment = lite.toStdColor(pigment);158 normal = lite.faceforward(lite.normalize(normal), this.incident);159 var v = lite.scale(-1, this.incident), specular, color,160 ambient = lite.scaleColor(finish.Ka, this.ambient),161 shadow = lite.saturate(-4 * lite.dot(normal, this.incident));162 if("phong" in finish){163 specular = lite.scaleColor(shadow * finish.Ks * finish.phong, lite.phong(normal, v, finish.phong_size, this.lights));164 }else{165 specular = lite.scaleColor(shadow * finish.Ks, lite.specular(normal, v, finish.roughness, this.lights));166 }167 color = lite.scaleColor(pigment.a, lite.addColor(lite.multiplyColor(pigment, ambient), lite.multiplyColor(this.specular, specular)));168 color.a = pigment.a;169 return lite.fromStdColor(lite.saturateColor(color));170 },171 plastic: function(normal, finish, pigment){172 if(typeof finish == "string"){ finish = lite.finish[finish]; }173 pigment = lite.toStdColor(pigment);174 normal = lite.faceforward(lite.normalize(normal), this.incident);175 var v = lite.scale(-1, this.incident), specular, color,176 ambient = lite.scaleColor(finish.Ka, this.ambient),177 shadow = lite.saturate(-4 * lite.dot(normal, this.incident)),178 diffuse = lite.scaleColor(shadow * finish.Kd, lite.diffuse(normal, this.lights));179 if("phong" in finish){180 specular = lite.scaleColor(shadow * finish.Ks * finish.phong, lite.phong(normal, v, finish.phong_size, this.lights));181 }else{182 specular = lite.scaleColor(shadow * finish.Ks, lite.specular(normal, v, finish.roughness, this.lights));183 }184 color = lite.scaleColor(pigment.a, lite.addColor(lite.multiplyColor(pigment, lite.addColor(ambient, diffuse)), lite.multiplyColor(this.specular, specular)));185 color.a = pigment.a;186 return lite.fromStdColor(lite.saturateColor(color));187 },188 npr: function(normal, finish, pigment){189 if(typeof finish == "string"){ finish = lite.finish[finish]; }190 pigment = lite.toStdColor(pigment);191 normal = lite.faceforward(lite.normalize(normal), this.incident);192 var ambient = lite.scaleColor(finish.Ka, this.ambient),193 shadow = lite.saturate(-4 * lite.dot(normal, this.incident)),194 diffuse = lite.scaleColor(shadow * finish.Kd, lite.diffuse(normal, this.lights)),195 color = lite.scaleColor(pigment.a, lite.multiplyColor(pigment, lite.addColor(ambient, diffuse))),196 cool = lite.addColor(this.npr_cool, lite.scaleColor(this.npr_alpha, color)),197 warm = lite.addColor(this.npr_warm, lite.scaleColor(this.npr_beta, color)),198 d = (1 + lite.dot(this.incident, normal)) / 2,199 color = lite.scaleColor(this.npr_scale, lite.addColor(color, lite.mixColor(cool, warm, d)));200 color.a = pigment.a;201 return lite.fromStdColor(lite.saturateColor(color));202 }203 });204 // POV-Ray basic finishes205 206 gfx3d.lighting.finish = {207 208 // Default209 210 defaults: {Ka: 0.1, Kd: 0.6, Ks: 0.0, roughness: 0.05},211 212 dull: {Ka: 0.1, Kd: 0.6, Ks: 0.5, roughness: 0.15},213 shiny: {Ka: 0.1, Kd: 0.6, Ks: 1.0, roughness: 0.001},214 glossy: {Ka: 0.1, Kd: 0.6, Ks: 1.0, roughness: 0.0001},215 216 phong_dull: {Ka: 0.1, Kd: 0.6, Ks: 0.5, phong: 0.5, phong_size: 1},217 phong_shiny: {Ka: 0.1, Kd: 0.6, Ks: 1.0, phong: 1.0, phong_size: 200},218 phong_glossy: {Ka: 0.1, Kd: 0.6, Ks: 1.0, phong: 1.0, phong_size: 300},219 220 luminous: {Ka: 1.0, Kd: 0.0, Ks: 0.0, roughness: 0.05},221 222 // Metals223 224 // very soft and dull225 metalA: {Ka: 0.35, Kd: 0.3, Ks: 0.8, roughness: 1/20},226 // fairly soft and dull227 metalB: {Ka: 0.30, Kd: 0.4, Ks: 0.7, roughness: 1/60},228 // medium reflectivity, holds color well229 metalC: {Ka: 0.25, Kd: 0.5, Ks: 0.8, roughness: 1/80},230 // highly hard and polished, high reflectivity231 metalD: {Ka: 0.15, Kd: 0.6, Ks: 0.8, roughness: 1/100},232 // very highly polished and reflective233 metalE: {Ka: 0.10, Kd: 0.7, Ks: 0.8, roughness: 1/120}234 };235 return lite;...

Full Screen

Full Screen

lighting.js.uncompressed.js

Source:lighting.js.uncompressed.js Github

copy

Full Screen

1define("dojox/gfx3d/lighting", [2 "dojo/_base/lang",3 "dojo/_base/Color", // dojo.Color4 "dojo/_base/declare", // declare5 "dojox/gfx/_base",6 "./_base"7],function(lang,Color,declare,gfx,gfx3d) {8 var lite = gfx3d.lighting = {9 // color utilities10 black: function(){11 return {r: 0, g: 0, b: 0, a: 1};12 },13 white: function(){14 return {r: 1, g: 1, b: 1, a: 1};15 },16 toStdColor: function(c){17 c = gfx.normalizeColor(c);18 return {r: c.r / 255, g: c.g / 255, b: c.b / 255, a: c.a};19 },20 fromStdColor: function(c){21 return new Color([Math.round(255 * c.r), Math.round(255 * c.g), Math.round(255 * c.b), c.a]);22 },23 scaleColor: function(s, c){24 return {r: s * c.r, g: s * c.g, b: s * c.b, a: s * c.a};25 },26 addColor: function(a, b){27 return {r: a.r + b.r, g: a.g + b.g, b: a.b + b.b, a: a.a + b.a};28 },29 multiplyColor: function(a, b){30 return {r: a.r * b.r, g: a.g * b.g, b: a.b * b.b, a: a.a * b.a};31 },32 saturateColor: function(c){33 return {34 r: c.r < 0 ? 0 : c.r > 1 ? 1 : c.r,35 g: c.g < 0 ? 0 : c.g > 1 ? 1 : c.g,36 b: c.b < 0 ? 0 : c.b > 1 ? 1 : c.b,37 a: c.a < 0 ? 0 : c.a > 1 ? 1 : c.a38 };39 },40 mixColor: function(c1, c2, s){41 return lite.addColor(lite.scaleColor(s, c1), lite.scaleColor(1 - s, c2));42 },43 diff2Color: function(c1, c2){44 var r = c1.r - c2.r;45 var g = c1.g - c2.g;46 var b = c1.b - c2.b;47 var a = c1.a - c2.a;48 return r * r + g * g + b * b + a * a;49 },50 length2Color: function(c){51 return c.r * c.r + c.g * c.g + c.b * c.b + c.a * c.a;52 },53 54 // vector utilities55 //TODO: move vector utilities from this file to vector.js56 dot: function(a, b){57 return a.x * b.x + a.y * b.y + a.z * b.z;58 },59 scale: function(s, v){60 return {x: s * v.x, y: s * v.y, z: s * v.z};61 },62 add: function(a, b){63 return {x: a.x + b.x, y: a.y + b.y, z: a.z + b.z};64 },65 saturate: function(v){66 return Math.min(Math.max(v, 0), 1);67 },68 length: function(v){69 return Math.sqrt(gfx3d.lighting.dot(v, v));70 },71 normalize: function(v){72 return lite.scale(1 / lite.length(v), v);73 },74 faceforward: function(n, i){75 var p = gfx3d.lighting;76 var s = p.dot(i, n) < 0 ? 1 : -1;77 return p.scale(s, n);78 },79 reflect: function(i, n){80 var p = gfx3d.lighting;81 return p.add(i, p.scale(-2 * p.dot(i, n), n));82 },83 84 // lighting utilities85 diffuse: function(normal, lights){86 var c = lite.black();87 for(var i = 0; i < lights.length; ++i){88 var l = lights[i],89 d = lite.dot(lite.normalize(l.direction), normal);90 c = lite.addColor(c, lite.scaleColor(d, l.color));91 }92 return lite.saturateColor(c);93 },94 specular: function(normal, v, roughness, lights){95 var c = lite.black();96 for(var i = 0; i < lights.length; ++i){97 var l = lights[i],98 h = lite.normalize(lite.add(lite.normalize(l.direction), v)),99 s = Math.pow(Math.max(0, lite.dot(normal, h)), 1 / roughness);100 c = lite.addColor(c, lite.scaleColor(s, l.color));101 }102 return lite.saturateColor(c);103 },104 phong: function(normal, v, size, lights){105 normal = lite.normalize(normal);106 var c = lite.black();107 for(var i = 0; i < lights.length; ++i){108 var l = lights[i],109 r = lite.reflect(lite.scale(-1, lite.normalize(v)), normal),110 s = Math.pow(Math.max(0, lite.dot(r, lite.normalize(l.direction))), size);111 c = lite.addColor(c, lite.scaleColor(s, l.color));112 }113 return lite.saturateColor(c);114 }115 };116 // this lighting model is derived from RenderMan Interface Specification Version 3.2117 declare("dojox.gfx3d.lighting.Model", null, {118 constructor: function(incident, lights, ambient, specular){119 this.incident = lite.normalize(incident);120 this.lights = [];121 for(var i = 0; i < lights.length; ++i){122 var l = lights[i];123 this.lights.push({direction: lite.normalize(l.direction), color: lite.toStdColor(l.color)});124 }125 this.ambient = lite.toStdColor(ambient.color ? ambient.color : "white");126 this.ambient = lite.scaleColor(ambient.intensity, this.ambient);127 this.ambient = lite.scaleColor(this.ambient.a, this.ambient);128 this.ambient.a = 1;129 this.specular = lite.toStdColor(specular ? specular : "white");130 this.specular = lite.scaleColor(this.specular.a, this.specular);131 this.specular.a = 1;132 this.npr_cool = {r: 0, g: 0, b: 0.4, a: 1};133 this.npr_warm = {r: 0.4, g: 0.4, b: 0.2, a: 1};134 this.npr_alpha = 0.2;135 this.npr_beta = 0.6;136 this.npr_scale = 0.6;137 },138 constant: function(normal, finish, pigment){139 pigment = lite.toStdColor(pigment);140 var alpha = pigment.a, color = lite.scaleColor(alpha, pigment);141 color.a = alpha;142 return lite.fromStdColor(lite.saturateColor(color));143 },144 matte: function(normal, finish, pigment){145 if(typeof finish == "string"){ finish = lite.finish[finish]; }146 pigment = lite.toStdColor(pigment);147 normal = lite.faceforward(lite.normalize(normal), this.incident);148 var ambient = lite.scaleColor(finish.Ka, this.ambient),149 shadow = lite.saturate(-4 * lite.dot(normal, this.incident)),150 diffuse = lite.scaleColor(shadow * finish.Kd, lite.diffuse(normal, this.lights)),151 color = lite.scaleColor(pigment.a, lite.multiplyColor(pigment, lite.addColor(ambient, diffuse)));152 color.a = pigment.a;153 return lite.fromStdColor(lite.saturateColor(color));154 },155 metal: function(normal, finish, pigment){156 if(typeof finish == "string"){ finish = lite.finish[finish]; }157 pigment = lite.toStdColor(pigment);158 normal = lite.faceforward(lite.normalize(normal), this.incident);159 var v = lite.scale(-1, this.incident), specular, color,160 ambient = lite.scaleColor(finish.Ka, this.ambient),161 shadow = lite.saturate(-4 * lite.dot(normal, this.incident));162 if("phong" in finish){163 specular = lite.scaleColor(shadow * finish.Ks * finish.phong, lite.phong(normal, v, finish.phong_size, this.lights));164 }else{165 specular = lite.scaleColor(shadow * finish.Ks, lite.specular(normal, v, finish.roughness, this.lights));166 }167 color = lite.scaleColor(pigment.a, lite.addColor(lite.multiplyColor(pigment, ambient), lite.multiplyColor(this.specular, specular)));168 color.a = pigment.a;169 return lite.fromStdColor(lite.saturateColor(color));170 },171 plastic: function(normal, finish, pigment){172 if(typeof finish == "string"){ finish = lite.finish[finish]; }173 pigment = lite.toStdColor(pigment);174 normal = lite.faceforward(lite.normalize(normal), this.incident);175 var v = lite.scale(-1, this.incident), specular, color,176 ambient = lite.scaleColor(finish.Ka, this.ambient),177 shadow = lite.saturate(-4 * lite.dot(normal, this.incident)),178 diffuse = lite.scaleColor(shadow * finish.Kd, lite.diffuse(normal, this.lights));179 if("phong" in finish){180 specular = lite.scaleColor(shadow * finish.Ks * finish.phong, lite.phong(normal, v, finish.phong_size, this.lights));181 }else{182 specular = lite.scaleColor(shadow * finish.Ks, lite.specular(normal, v, finish.roughness, this.lights));183 }184 color = lite.scaleColor(pigment.a, lite.addColor(lite.multiplyColor(pigment, lite.addColor(ambient, diffuse)), lite.multiplyColor(this.specular, specular)));185 color.a = pigment.a;186 return lite.fromStdColor(lite.saturateColor(color));187 },188 npr: function(normal, finish, pigment){189 if(typeof finish == "string"){ finish = lite.finish[finish]; }190 pigment = lite.toStdColor(pigment);191 normal = lite.faceforward(lite.normalize(normal), this.incident);192 var ambient = lite.scaleColor(finish.Ka, this.ambient),193 shadow = lite.saturate(-4 * lite.dot(normal, this.incident)),194 diffuse = lite.scaleColor(shadow * finish.Kd, lite.diffuse(normal, this.lights)),195 color = lite.scaleColor(pigment.a, lite.multiplyColor(pigment, lite.addColor(ambient, diffuse))),196 cool = lite.addColor(this.npr_cool, lite.scaleColor(this.npr_alpha, color)),197 warm = lite.addColor(this.npr_warm, lite.scaleColor(this.npr_beta, color)),198 d = (1 + lite.dot(this.incident, normal)) / 2,199 color = lite.scaleColor(this.npr_scale, lite.addColor(color, lite.mixColor(cool, warm, d)));200 color.a = pigment.a;201 return lite.fromStdColor(lite.saturateColor(color));202 }203 });204 // POV-Ray basic finishes205 206 gfx3d.lighting.finish = {207 208 // Default209 210 defaults: {Ka: 0.1, Kd: 0.6, Ks: 0.0, roughness: 0.05},211 212 dull: {Ka: 0.1, Kd: 0.6, Ks: 0.5, roughness: 0.15},213 shiny: {Ka: 0.1, Kd: 0.6, Ks: 1.0, roughness: 0.001},214 glossy: {Ka: 0.1, Kd: 0.6, Ks: 1.0, roughness: 0.0001},215 216 phong_dull: {Ka: 0.1, Kd: 0.6, Ks: 0.5, phong: 0.5, phong_size: 1},217 phong_shiny: {Ka: 0.1, Kd: 0.6, Ks: 1.0, phong: 1.0, phong_size: 200},218 phong_glossy: {Ka: 0.1, Kd: 0.6, Ks: 1.0, phong: 1.0, phong_size: 300},219 220 luminous: {Ka: 1.0, Kd: 0.0, Ks: 0.0, roughness: 0.05},221 222 // Metals223 224 // very soft and dull225 metalA: {Ka: 0.35, Kd: 0.3, Ks: 0.8, roughness: 1/20},226 // fairly soft and dull227 metalB: {Ka: 0.30, Kd: 0.4, Ks: 0.7, roughness: 1/60},228 // medium reflectivity, holds color well229 metalC: {Ka: 0.25, Kd: 0.5, Ks: 0.8, roughness: 1/80},230 // highly hard and polished, high reflectivity231 metalD: {Ka: 0.15, Kd: 0.6, Ks: 0.8, roughness: 1/100},232 // very highly polished and reflective233 metalE: {Ka: 0.10, Kd: 0.7, Ks: 0.8, roughness: 1/120}234 };235 return lite;...

Full Screen

Full Screen

lighting.js

Source:lighting.js Github

copy

Full Screen

1define([2 "dojo/_base/lang",3 "dojo/_base/Color", // dojo.Color4 "dojo/_base/declare", // declare5 "dojox/gfx/_base",6 "./_base"7],function(lang,Color,declare,gfx,gfx3d) {8 var lite = gfx3d.lighting = {9 // color utilities10 black: function(){11 return {r: 0, g: 0, b: 0, a: 1};12 },13 white: function(){14 return {r: 1, g: 1, b: 1, a: 1};15 },16 toStdColor: function(c){17 c = gfx.normalizeColor(c);18 return {r: c.r / 255, g: c.g / 255, b: c.b / 255, a: c.a};19 },20 fromStdColor: function(c){21 return new Color([Math.round(255 * c.r), Math.round(255 * c.g), Math.round(255 * c.b), c.a]);22 },23 scaleColor: function(s, c){24 return {r: s * c.r, g: s * c.g, b: s * c.b, a: s * c.a};25 },26 addColor: function(a, b){27 return {r: a.r + b.r, g: a.g + b.g, b: a.b + b.b, a: a.a + b.a};28 },29 multiplyColor: function(a, b){30 return {r: a.r * b.r, g: a.g * b.g, b: a.b * b.b, a: a.a * b.a};31 },32 saturateColor: function(c){33 return {34 r: c.r < 0 ? 0 : c.r > 1 ? 1 : c.r,35 g: c.g < 0 ? 0 : c.g > 1 ? 1 : c.g,36 b: c.b < 0 ? 0 : c.b > 1 ? 1 : c.b,37 a: c.a < 0 ? 0 : c.a > 1 ? 1 : c.a38 };39 },40 mixColor: function(c1, c2, s){41 return lite.addColor(lite.scaleColor(s, c1), lite.scaleColor(1 - s, c2));42 },43 diff2Color: function(c1, c2){44 var r = c1.r - c2.r;45 var g = c1.g - c2.g;46 var b = c1.b - c2.b;47 var a = c1.a - c2.a;48 return r * r + g * g + b * b + a * a;49 },50 length2Color: function(c){51 return c.r * c.r + c.g * c.g + c.b * c.b + c.a * c.a;52 },53 54 // vector utilities55 //TODO: move vector utilities from this file to vector.js56 dot: function(a, b){57 return a.x * b.x + a.y * b.y + a.z * b.z;58 },59 scale: function(s, v){60 return {x: s * v.x, y: s * v.y, z: s * v.z};61 },62 add: function(a, b){63 return {x: a.x + b.x, y: a.y + b.y, z: a.z + b.z};64 },65 saturate: function(v){66 return Math.min(Math.max(v, 0), 1);67 },68 length: function(v){69 return Math.sqrt(gfx3d.lighting.dot(v, v));70 },71 normalize: function(v){72 return lite.scale(1 / lite.length(v), v);73 },74 faceforward: function(n, i){75 var p = gfx3d.lighting;76 var s = p.dot(i, n) < 0 ? 1 : -1;77 return p.scale(s, n);78 },79 reflect: function(i, n){80 var p = gfx3d.lighting;81 return p.add(i, p.scale(-2 * p.dot(i, n), n));82 },83 84 // lighting utilities85 diffuse: function(normal, lights){86 var c = lite.black();87 for(var i = 0; i < lights.length; ++i){88 var l = lights[i],89 d = lite.dot(lite.normalize(l.direction), normal);90 c = lite.addColor(c, lite.scaleColor(d, l.color));91 }92 return lite.saturateColor(c);93 },94 specular: function(normal, v, roughness, lights){95 var c = lite.black();96 for(var i = 0; i < lights.length; ++i){97 var l = lights[i],98 h = lite.normalize(lite.add(lite.normalize(l.direction), v)),99 s = Math.pow(Math.max(0, lite.dot(normal, h)), 1 / roughness);100 c = lite.addColor(c, lite.scaleColor(s, l.color));101 }102 return lite.saturateColor(c);103 },104 phong: function(normal, v, size, lights){105 normal = lite.normalize(normal);106 var c = lite.black();107 for(var i = 0; i < lights.length; ++i){108 var l = lights[i],109 r = lite.reflect(lite.scale(-1, lite.normalize(v)), normal),110 s = Math.pow(Math.max(0, lite.dot(r, lite.normalize(l.direction))), size);111 c = lite.addColor(c, lite.scaleColor(s, l.color));112 }113 return lite.saturateColor(c);114 }115 };116 // this lighting model is derived from RenderMan Interface Specification Version 3.2117 declare("dojox.gfx3d.lighting.Model", null, {118 constructor: function(incident, lights, ambient, specular){119 this.incident = lite.normalize(incident);120 this.lights = [];121 for(var i = 0; i < lights.length; ++i){122 var l = lights[i];123 this.lights.push({direction: lite.normalize(l.direction), color: lite.toStdColor(l.color)});124 }125 this.ambient = lite.toStdColor(ambient.color ? ambient.color : "white");126 this.ambient = lite.scaleColor(ambient.intensity, this.ambient);127 this.ambient = lite.scaleColor(this.ambient.a, this.ambient);128 this.ambient.a = 1;129 this.specular = lite.toStdColor(specular ? specular : "white");130 this.specular = lite.scaleColor(this.specular.a, this.specular);131 this.specular.a = 1;132 this.npr_cool = {r: 0, g: 0, b: 0.4, a: 1};133 this.npr_warm = {r: 0.4, g: 0.4, b: 0.2, a: 1};134 this.npr_alpha = 0.2;135 this.npr_beta = 0.6;136 this.npr_scale = 0.6;137 },138 constant: function(normal, finish, pigment){139 pigment = lite.toStdColor(pigment);140 var alpha = pigment.a, color = lite.scaleColor(alpha, pigment);141 color.a = alpha;142 return lite.fromStdColor(lite.saturateColor(color));143 },144 matte: function(normal, finish, pigment){145 if(typeof finish == "string"){ finish = lite.finish[finish]; }146 pigment = lite.toStdColor(pigment);147 normal = lite.faceforward(lite.normalize(normal), this.incident);148 var ambient = lite.scaleColor(finish.Ka, this.ambient),149 shadow = lite.saturate(-4 * lite.dot(normal, this.incident)),150 diffuse = lite.scaleColor(shadow * finish.Kd, lite.diffuse(normal, this.lights)),151 color = lite.scaleColor(pigment.a, lite.multiplyColor(pigment, lite.addColor(ambient, diffuse)));152 color.a = pigment.a;153 return lite.fromStdColor(lite.saturateColor(color));154 },155 metal: function(normal, finish, pigment){156 if(typeof finish == "string"){ finish = lite.finish[finish]; }157 pigment = lite.toStdColor(pigment);158 normal = lite.faceforward(lite.normalize(normal), this.incident);159 var v = lite.scale(-1, this.incident), specular, color,160 ambient = lite.scaleColor(finish.Ka, this.ambient),161 shadow = lite.saturate(-4 * lite.dot(normal, this.incident));162 if("phong" in finish){163 specular = lite.scaleColor(shadow * finish.Ks * finish.phong, lite.phong(normal, v, finish.phong_size, this.lights));164 }else{165 specular = lite.scaleColor(shadow * finish.Ks, lite.specular(normal, v, finish.roughness, this.lights));166 }167 color = lite.scaleColor(pigment.a, lite.addColor(lite.multiplyColor(pigment, ambient), lite.multiplyColor(this.specular, specular)));168 color.a = pigment.a;169 return lite.fromStdColor(lite.saturateColor(color));170 },171 plastic: function(normal, finish, pigment){172 if(typeof finish == "string"){ finish = lite.finish[finish]; }173 pigment = lite.toStdColor(pigment);174 normal = lite.faceforward(lite.normalize(normal), this.incident);175 var v = lite.scale(-1, this.incident), specular, color,176 ambient = lite.scaleColor(finish.Ka, this.ambient),177 shadow = lite.saturate(-4 * lite.dot(normal, this.incident)),178 diffuse = lite.scaleColor(shadow * finish.Kd, lite.diffuse(normal, this.lights));179 if("phong" in finish){180 specular = lite.scaleColor(shadow * finish.Ks * finish.phong, lite.phong(normal, v, finish.phong_size, this.lights));181 }else{182 specular = lite.scaleColor(shadow * finish.Ks, lite.specular(normal, v, finish.roughness, this.lights));183 }184 color = lite.scaleColor(pigment.a, lite.addColor(lite.multiplyColor(pigment, lite.addColor(ambient, diffuse)), lite.multiplyColor(this.specular, specular)));185 color.a = pigment.a;186 return lite.fromStdColor(lite.saturateColor(color));187 },188 npr: function(normal, finish, pigment){189 if(typeof finish == "string"){ finish = lite.finish[finish]; }190 pigment = lite.toStdColor(pigment);191 normal = lite.faceforward(lite.normalize(normal), this.incident);192 var ambient = lite.scaleColor(finish.Ka, this.ambient),193 shadow = lite.saturate(-4 * lite.dot(normal, this.incident)),194 diffuse = lite.scaleColor(shadow * finish.Kd, lite.diffuse(normal, this.lights)),195 color = lite.scaleColor(pigment.a, lite.multiplyColor(pigment, lite.addColor(ambient, diffuse))),196 cool = lite.addColor(this.npr_cool, lite.scaleColor(this.npr_alpha, color)),197 warm = lite.addColor(this.npr_warm, lite.scaleColor(this.npr_beta, color)),198 d = (1 + lite.dot(this.incident, normal)) / 2,199 color = lite.scaleColor(this.npr_scale, lite.addColor(color, lite.mixColor(cool, warm, d)));200 color.a = pigment.a;201 return lite.fromStdColor(lite.saturateColor(color));202 }203 });204 // POV-Ray basic finishes205 206 gfx3d.lighting.finish = {207 208 // Default209 210 defaults: {Ka: 0.1, Kd: 0.6, Ks: 0.0, roughness: 0.05},211 212 dull: {Ka: 0.1, Kd: 0.6, Ks: 0.5, roughness: 0.15},213 shiny: {Ka: 0.1, Kd: 0.6, Ks: 1.0, roughness: 0.001},214 glossy: {Ka: 0.1, Kd: 0.6, Ks: 1.0, roughness: 0.0001},215 216 phong_dull: {Ka: 0.1, Kd: 0.6, Ks: 0.5, phong: 0.5, phong_size: 1},217 phong_shiny: {Ka: 0.1, Kd: 0.6, Ks: 1.0, phong: 1.0, phong_size: 200},218 phong_glossy: {Ka: 0.1, Kd: 0.6, Ks: 1.0, phong: 1.0, phong_size: 300},219 220 luminous: {Ka: 1.0, Kd: 0.0, Ks: 0.0, roughness: 0.05},221 222 // Metals223 224 // very soft and dull225 metalA: {Ka: 0.35, Kd: 0.3, Ks: 0.8, roughness: 1/20},226 // fairly soft and dull227 metalB: {Ka: 0.30, Kd: 0.4, Ks: 0.7, roughness: 1/60},228 // medium reflectivity, holds color well229 metalC: {Ka: 0.25, Kd: 0.5, Ks: 0.8, roughness: 1/80},230 // highly hard and polished, high reflectivity231 metalD: {Ka: 0.15, Kd: 0.6, Ks: 0.8, roughness: 1/100},232 // very highly polished and reflective233 metalE: {Ka: 0.10, Kd: 0.7, Ks: 0.8, roughness: 1/120}234 };235 return lite;...

Full Screen

Full Screen

app.js

Source:app.js Github

copy

Full Screen

1let result = document.getElementById("result");2let finishElement = document.getElementById("finish");3let numbersElement = document.getElementById("numbers");4const calculateButton = document.querySelector("#calculator button");5function calculate() {6 let sum = 0;7 let startInput = document.getElementById("startValue");8 let finishInput = document.getElementById("finishValue");9 let startValue = +document.getElementById("startValue").value;10 let finishValue = +document.getElementById("finishValue").value;11 // s1 ve s2 pozitif12 if (startValue > 0 && finishValue > 0) {13 if (startValue < finishValue) {14 let numbers = [];15 for (i = startValue; i <= finishValue; i++) {16 sum = sum + i;17 numbers.push(i);18 }19 console.log(numbers);20 // let tempTextFinish = `${startValue}21 // ile22 // ${finishValue}23 // arasındaki işleme alınan sayı adedi:24 // ${finishValue - startValue + 1}25 // `;26 // let tempTextNumbers = `27 // ${numbers}`;28 // finishElement.textContent = tempTextFinish;29 // numbersElement.textContent = tempTextNumbers30 let tempText =31 startValue +32 " ile " +33 finishValue +34 " aralığındaki sayı adedi: " +35 (finishValue - startValue + 1);36 finishElement.textContent = tempText;37 result.textContent = "Toplam: " + sum;38 startInput.value = null;39 finishInput.value = null;40 console.log(startInput);41 } else {42 for (i = startValue; i >= finishValue; i--) {43 sum = sum + i;44 }45 let tempText =46 startValue +47 " ile " +48 finishValue +49 " aralığındaki sayı adedi: " +50 (startValue - finishValue + 1);51 finishElement.textContent = tempText;52 result.textContent = "Toplam: " + sum;53 startInput.value = null;54 finishInput.value = null;55 }56 }57 // s1 veya s2 negatif58 else if (startValue < 0 && finishValue > 0) {59 if (startValue * -1 < finishValue) {60 let tempStartValue = startValue * -1;61 for (i = finishValue; i > tempStartValue; i--) {62 sum = sum + i;63 }64 let tempText =65 startValue +66 " ile " +67 finishValue +68 " aralığındaki sayı adedi: " +69 (startValue * -1 + finishValue + 1);70 finishElement.textContent = tempText;71 result.textContent = "Toplam: " + sum;72 startInput.value = null;73 finishInput.value = null;74 } else {75 let tempStartValue = startValue * -1;76 for (i = tempStartValue; i > finishValue; i--) {77 sum = sum + i;78 }79 let tempText =80 startValue +81 " ile " +82 finishValue +83 " aralığındaki sayı adedi: " +84 (1 + startValue * -1 + finishValue);85 finishElement.textContent = tempText;86 result.textContent = "Toplam: " + -sum;87 startInput.value = null;88 finishInput.value = null;89 }90 } else if (startValue > 0 && finishValue < 0) {91 if (startValue < finishValue * -1) {92 let tempFinishValue = finishValue * -1;93 for (i = tempFinishValue; i > startValue; i--) {94 sum = sum + i;95 }96 let tempText =97 startValue +98 " ile " +99 finishValue +100 " aralığındaki sayı adedi: " +101 (1 + startValue + finishValue * -1);102 finishElement.textContent = tempText;103 result.textContent = "Toplam: " + -sum;104 startInput.value = null;105 finishInput.value = null;106 } else {107 let tempFinishValue = finishValue * -1;108 for (i = startValue; i > tempFinishValue; i--) {109 sum = sum + i;110 }111 let tempText =112 startValue +113 " ile " +114 finishValue +115 " aralığındaki sayı adedi: " +116 (1 + startValue + finishValue * -1);117 finishElement.textContent = tempText;118 result.textContent = "Toplam: " + sum;119 startInput.value = null;120 finishInput.value = null;121 }122 } else {123 if (startValue * -1 > finishValue * -1) {124 let tempStart = startValue * -1;125 let tempFinish = finishValue * -1;126 for (i = tempFinish; i <= tempStart; i++) {127 sum = sum + i;128 }129 let tempText =130 startValue +131 " ile " +132 finishValue +133 " aralığındaki sayı adedi: " +134 (tempStart - tempFinish + 1);135 finishElement.textContent = tempText;136 result.textContent = "Toplam: " + -sum;137 startInput.value = null;138 finishInput.value = null;139 } else if (140 startValue == finishValue ||141 startValue * -1 == finishValue ||142 startValue == finishValue * -1143 ) {144 result.textContent = 0;145 } else {146 let tempStart = startValue * -1;147 let tempFinish = finishValue * -1;148 for (i = tempStart; i <= tempFinish; i++) {149 sum = sum + i;150 }151 let tempText =152 startValue +153 " ile " +154 finishValue +155 " aralığındaki sayı adedi: " +156 (tempFinish - tempStart + 1);157 finishElement.textContent = tempText;158 result.textContent = "Toplam: " + -sum;159 startInput.value = null;160 finishInput.value = null;161 }162 }163}...

Full Screen

Full Screen

bidirectionalGreedySearch.js

Source:bidirectionalGreedySearch.js Github

copy

Full Screen

1export const bidirectionalGreedySearch = (grid, startNode, finishNode) => {2 const visitedNodesInOrderStart = []3 const visitedNodesInOrderFinish = []4 const unvisitedNodesStart = []5 const unvisitedNodesFinish = []6 startNode.distance = 07 finishNode.distance = 08 unvisitedNodesStart.push(startNode)9 unvisitedNodesFinish.push(finishNode)10 while (unvisitedNodesStart.length && unvisitedNodesFinish.length) {11 sortNodesByDistance(unvisitedNodesStart)12 sortNodesByDistance(unvisitedNodesFinish)13 const closestNodeStart = unvisitedNodesStart.shift()14 const closestNodeFinish = unvisitedNodesFinish.shift()15 //if (closestNodeStart.isWall || closestNodeFinish.isWall) continue16 if (isNeighbors(closestNodeStart, closestNodeFinish)) return [visitedNodesInOrderStart, visitedNodesInOrderFinish]17 closestNodeStart.isVisited = true18 closestNodeFinish.isVisited = true19 visitedNodesInOrderStart.push(closestNodeStart)20 visitedNodesInOrderFinish.push(closestNodeFinish)21 //Search22 const unvisitedNeighborsStart = getUnvisitedNeighbors(closestNodeStart, grid)23 const unvisitedNeighborsFinish = getUnvisitedNeighbors(closestNodeFinish, grid)24 for (const neighbor of unvisitedNeighborsStart) {25 const distance = closestNodeStart.distance + 126 if (unvisitedNodesFinish.includes(neighbor)) {27 visitedNodesInOrderStart.push(closestNodeStart)28 visitedNodesInOrderFinish.push(neighbor)29 return [visitedNodesInOrderStart, visitedNodesInOrderFinish]30 }31 if (!unvisitedNodesStart.includes(neighbor)) {32 unvisitedNodesStart.unshift(neighbor)33 neighbor.distance = distance34 neighbor.totalDistance = manhattanDistance(neighbor, finishNode)35 neighbor.previousNode = closestNodeStart36 } else if (distance < neighbor.distance) {37 neighbor.distance = distance38 neighbor.totalDistance = manhattanDistance(neighbor, finishNode)39 neighbor.previousNode = closestNodeStart40 }41 }42 for (const neighbor of unvisitedNeighborsFinish) {43 const distance = closestNodeFinish.distance + 144 if (unvisitedNodesStart.includes(neighbor)) {45 visitedNodesInOrderStart.push(closestNodeFinish)46 visitedNodesInOrderStart.push(neighbor)47 return [visitedNodesInOrderStart, visitedNodesInOrderFinish]48 }49 if (!unvisitedNodesFinish.includes(neighbor)) {50 unvisitedNodesFinish.unshift(neighbor)51 neighbor.distance = distance52 neighbor.totalDistance = manhattanDistance(neighbor, startNode)53 neighbor.previousNode = closestNodeFinish54 } else if (distance < neighbor.distance) {55 neighbor.distance = distance56 neighbor.totalDistance = manhattanDistance(neighbor, startNode)57 neighbor.previousNode = closestNodeFinish58 }59 }60 }61 return [visitedNodesInOrderStart, visitedNodesInOrderFinish]62}63const isNeighbors = (nodeA, nodeB) => {64 if (nodeA.row === nodeB.row && nodeA.col === nodeB.col) return true65 return false66}67const manhattanDistance = (node, finishNode) => {68 const row = Math.abs(node.row - finishNode.row)69 const col = Math.abs(node.col - finishNode.col)70 return row + col71}72const getUnvisitedNeighbors = (node, grid) => {73 const neighbors = []74 const { row, col } = node75 if (row > 0) neighbors.push(grid[row - 1][col])76 if (row < grid.length - 1) neighbors.push(grid[row + 1][col])77 if (col > 0) neighbors.push(grid[row][col - 1])78 if (col < grid[0].length - 1) neighbors.push(grid[row][col + 1])79 return neighbors.filter(neighbor => !neighbor.isWall && !neighbor.isVisited)80}81const sortNodesByDistance = (nodes) => (82 nodes.sort((a, b) => a.totalDistance - b.totalDistance)83)...

Full Screen

Full Screen

finish.js

Source:finish.js Github

copy

Full Screen

1function updateFinish() {2 for (var i = 0; i < finishText.length; i++) {3 updateFinishLetter (i, 1);4 }5}67function updateFinishLetter (letterNum, frameNum) {8 while (frameNum > 0) {9 if (finishTextSpeed[letterNum][0] == 0 && finishTextSpeed[letterNum][2] < finish_text_speed_max) {10 finishTextSpeed[letterNum][2] += finish_text_speed_inc;11 finishTextSpeed[letterNum][1] += finishTextSpeed[letterNum][2];12 if (finishTextSpeed[letterNum][2] >= finish_text_speed_max) {13 finishTextSpeed[letterNum][2] = finish_text_speed_max;14 finishTextSpeed[letterNum][0] = 1;15 }16 } else if (finishTextSpeed[letterNum][0] == 1 && finishTextSpeed[letterNum][2] > 0) {17 finishTextSpeed[letterNum][2] -= finish_text_speed_inc;18 finishTextSpeed[letterNum][1] += finishTextSpeed[letterNum][2];19 if (finishTextSpeed[letterNum][2] <= 0) {20 finishTextSpeed[letterNum][2] = 0;21 finishTextSpeed[letterNum][0] = 2;22 }23 } else if (finishTextSpeed[letterNum][0] == 2 && finishTextSpeed[letterNum][2] < finish_text_speed_max) {24 finishTextSpeed[letterNum][2] += finish_text_speed_inc;25 finishTextSpeed[letterNum][1] -= finishTextSpeed[letterNum][2];26 if (finishTextSpeed[letterNum][2] >= finish_text_speed_max) {27 finishTextSpeed[letterNum][2] = finish_text_speed_max;28 finishTextSpeed[letterNum][0] = 3;29 }30 } else if (finishTextSpeed[letterNum][0] == 3 && finishTextSpeed[letterNum][2] > 0) {31 finishTextSpeed[letterNum][2] -= finish_text_speed_inc;32 finishTextSpeed[letterNum][1] -= finishTextSpeed[letterNum][2];33 if (finishTextSpeed[letterNum][2] <= 0) {34 finishTextSpeed[letterNum][2] = 0;35 finishTextSpeed[letterNum][0] = 0;36 }37 }38 frameNum--;39 }40}4142function initFinish() {43 for (var i = 0; i < finishText.length; i++) {44 finishTextSpeed[i] = [0, finish_text_startY, 0];45 updateFinishLetter(i, i * finish_text_staggerFrames);46 }47}4849function drawFinish() {50 51 // bg52 var grad = canvas.createLinearGradient(os.x, os.y, os.x, cwh(CANVAS_HEIGHT - BAR_HEIGHT * 2) + os.y);53 canvas.beginPath();54 canvas.rect(os.x, cwh(BAR_HEIGHT) + os.y, cwh(CANVAS_WIDTH), cwh(CANVAS_HEIGHT - BAR_HEIGHT * 2));55 //grad.addColorStop(0, INTERMISSION_COLOR_2_0);56 //grad.addColorStop(1, INTERMISSION_COLOR_2_1);57 grad.addColorStop(0, INTERMISSION_COLOR_0_0);58 grad.addColorStop(1, INTERMISSION_COLOR_0_1);59 canvas.fillStyle = grad;60 canvas.fill();61 62 // you win63 canvas.fillStyle = "#006";64 canvas.font = cwh(48) + "px Arial Black";65 canvas.textAlign = "center";66 67 for (var i = 0; i < finishText.length; i++) {68 canvas.fillText(finishText[i], cwh(finish_text_startX + (finish_title_spacing * i)) + os.x, cwh(finishTextSpeed[i][1]) + os.y);69 }70 71 // text72 canvas.fillStyle = "black";73 canvas.font = cwh(24) + "px Arial";74 canvas.textAlign = "center";75 canvas.fillText("Now try it with your eyes closed.", cwh(CANVAS_WIDTH / 2) + os.x, cwh(280) + os.y);76 77 // data78 canvas.fillStyle = "#555";79 canvas.font = cwh(24) + "px Arial";80 canvas.textAlign = "left";81 canvas.fillText("Fails:", cwh(finish_data_left) + os.x, cwh(370) + os.y);82 83 canvas.fillStyle = "#555";84 canvas.font = cwh(24) + "px Arial";85 canvas.textAlign = "left";86 canvas.fillText("Time:", cwh(finish_data_left) + os.x, cwh(400) + os.y);87 88 canvas.fillStyle = "black";89 canvas.font = cwh(24) + "px Arial";90 canvas.textAlign = "right";91 canvas.fillText(numberWithCommas(deaths), cwh(finish_data_right) + os.x, cwh(370) + os.y);92 93 canvas.fillStyle = "black";94 canvas.font = cwh(24) + "px Arial";95 canvas.textAlign = "right";96 canvas.fillText(msToTime(gameTimer), cwh(finish_data_right) + os.x, cwh(400) + os.y);97 98 99 // back to menu100 if (onButton("ls_menu"))101 canvas.fillStyle = LS_BUTTON_HOVER_COLOR;102 else103 canvas.fillStyle = "black";104 canvas.font = cwh(25) + "px Arial Black";105 canvas.textAlign = "center";106 canvas.fillText("BACK TO MENU ", cwh(CANVAS_WIDTH / 2) + os.x, cwh(535) + os.y);107 ...

Full Screen

Full Screen

calendarFromTo.js

Source:calendarFromTo.js Github

copy

Full Screen

1function initCalendarFromTo(startDateTime, finishDateTime) {2 // $("#datepicker").datepicker();3 // Date range4 $('.' + startDateTime).datepicker({5 dateFormat: 'dd-mm-yy',6 prevText: '<i class="fa fa-angle-left"></i>',7 nextText: '<i class="fa fa-angle-right"></i>',8 onSelect: function (selectedDate) {9 $('.' + finishDateTime).datepicker('option', 'minDate', selectedDate);10 }11 });12 $('.' + finishDateTime).datepicker({13 dateFormat: 'dd-mm-yy',14 prevText: '<i class="fa fa-angle-left"></i>',15 nextText: '<i class="fa fa-angle-right"></i>',16 onSelect: function (selectedDate) {17 $('.' + startDateTime).datepicker('option', 'maxDate', selectedDate);18 }19 });20 $(document).on('change', '.' + startDateTime + 'Start', function () {21 var value = $('.' + startDateTime + 'Start:checked').val(); //два варианта по в разных ситуациях22 //var value = $('.' + startDateTime + 'Start[checked="checked"]').val();23 if (parseInt(value) == 1) {24 $('.' + startDateTime).parents('div.col-sm-6').show();25 $('.' + startDateTime).val('').focus();26 $('.' + startDateTime).attr('required', 'required');27 $('.' + startDateTime + 'StartLabel').html('');28 }29 else {30 $('.' + startDateTime).parents('div.col-sm-6').hide();31 $('.' + startDateTime).val('');32 $('.' + startDateTime).removeAttr('required');33 $('.' + startDateTime + 'StartLabel').html('Дата начала показов');34 }35 });36 $(document).on('change', '.' + finishDateTime + 'Finish', function () {37 var value = $('.' + finishDateTime + 'Finish:checked').val();38 //var value = $('.' + finishDateTime + 'Finish[checked="checked"]').val();39 console.log('end='+value);40 if (parseInt(value) == 1) {41 $('.' + finishDateTime).parents('div.col-sm-6').show();42 $('.' + finishDateTime).val('').focus();43 $('.' + finishDateTime).attr('required', 'required');44 $('.' + finishDateTime + 'FinishLabel').html('');45 }46 else {47 $('.' + finishDateTime).parents('div.col-sm-6').hide();48 $('.' + finishDateTime).val('');49 $('.' + finishDateTime).removeAttr('required');50 $('.' + finishDateTime + 'FinishLabel').html('Дата окончания показов');51 }52 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const wdio = require('webdriverio');2const opts = {3 capabilities: {4 }5};6async function main() {7 const client = await wdio.remote(opts);8 await client.pause(5000);9 await client.finish();10 await client.deleteSession();11}12main();13 at createHangUpError (_http_client.js:331:15)14 at Socket.socketOnEnd (_http_client.js:424:23)15 at emitNone (events.js:111:20)16 at Socket.emit (events.js:208:7)17 at endReadableNT (_stream_readable.js:1064:12)18 at _combinedTickCallback (internal/process/next_tick.js:139:11)19 at process._tickCallback (internal/process/next_tick.js:181:9)20 at createHangUpError (_http_client.js:331:15)21 at Socket.socketOnEnd (_http_client.js:424:23)22 at emitNone (events.js:111:20)23 at Socket.emit (events.js:208:7)24 at endReadableNT (_stream_readable.js:1064:12)25 at _combinedTickCallback (internal/process/next_tick.js:139:11)26 at process._tickCallback (internal/process/next_tick.js:181:9)27 at createHangUpError (_http_client.js:331:15)28 at Socket.socketOnEnd (_http_client.js:424:

Full Screen

Using AI Code Generation

copy

Full Screen

1const wdio = require("webdriverio");2const opts = {3 capabilities: {4 }5};6(async () => {7 const client = await wdio.remote(opts);8 await client.pause(5000);9 await client.finish();10 await client.deleteSession();11})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const wd = require("wd");2const { assert } = require("chai");3const serverConfig = {4};5const capabilities = {6};7describe("TestApp", function() {8 this.timeout(300000);9 let driver;10 before(async () => {11 driver = await wd.promiseChainRemote(serverConfig);12 await driver.init(capabilities);13 await driver.setImplicitWaitTimeout(10000);14 });15 after(async () => {16 await driver.quit();17 });18 it("should click on button", async () => {19 const button = await driver.elementByAccessibilityId("button");20 await button.click();21 await driver.finish();22 });23});24Error: undefined is not an object (evaluating 'this._currentContext = this._contexts[0]')

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('Appium XCUITest Driver', function() {2 it('should be able to use finish method', async function() {3 await driver.finish();4 });5});6{7 "scripts": {8 },9 "devDependencies": {10 }11}

Full Screen

Using AI Code Generation

copy

Full Screen

1driver.closeApp();2driver.quit();3driver.closeApp();4driver.quit();5driver.closeApp();6driver.quit();7driver.closeApp();8driver.quit();9driver.closeApp();10driver.quit();11driver.closeApp();12driver.quit();13driver.closeApp();14driver.quit();15driver.closeApp();16driver.quit();17driver.closeApp();18driver.quit();19driver.closeApp();20driver.quit();21driver.closeApp();22driver.quit();23driver.closeApp();24driver.quit();25driver.closeApp();26driver.quit();27driver.closeApp();28driver.quit();29driver.closeApp();30driver.quit();

Full Screen

Using AI Code Generation

copy

Full Screen

1const wd = require('wd');2const chai = require('chai');3const chaiAsPromised = require('chai-as-promised');4chai.use(chaiAsPromised);5const expect = chai.expect;6const assert = chai.assert;7const should = chai.should();8const PORT = 4723;9const config = {10};11const driver = wd.promiseChainRemote('localhost', PORT);12describe('Appium XCUITest Driver', function () {13 this.timeout(300000);14 before(async () => {15 await driver.init(config);16 await driver.sleep(3000);17 });18 after(async () => {19 await driver.quit();20 });21 it('should finish the app', async () => {22 await driver.finish();23 });24});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var chai = require('chai');3var chaiAsPromised = require('chai-as-promised');4chai.use(chaiAsPromised);5var should = chai.should();6var assert = chai.assert;7var expect = chai.expect;8var _ = require('lodash');9var startServer = require('./helpers/appium').startServer;10var desired = require('./helpers/caps').desired;11describe('XCUITestDriver - finish session', function () {12 this.timeout(300000);13 var driver;14 var allPassed = true;15 before(function () {16 var args = {17 };18 return startServer(args).then(function (/*[sessionId, server]*/) {19 driver = wd.promiseChainRemote(args);20 require("./helpers/logging").configure(driver);21 desired.app = require('./helpers/apps').iosTestApp;22 return driver.init(desired);23 });24 });25 after(function () {26 .quit()27 .finally(function () {28 return driver.sauceJobStatus(allPassed);29 });30 });31 afterEach(function () {32 allPassed = allPassed && this.currentTest.state === 'passed';33 });34 it('should end the session and throw an error if the session is used again', function () {35 .execute('mobile: finish')36 .execute('mobile: alert', {action: 'accept'})37 .should.be.rejectedWith(/A session is either terminated or not started/);38 });39});40var desired = {41};42exports.desired = desired;43var wd = require('wd');44var q = require('q');45var path = require('path');46var _ = require('lodash');47var spawn = require('child_process').spawn;48var appium = null;49var appiumArgs = null;50var appiumServerStarted = false;51function startServer (args) {

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Appium Xcuitest Driver automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Sign up Free
_

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful