How to use roundedRect method in storybook-root

Best JavaScript code snippet using storybook-root

BCHWFont.js

Source:BCHWFont.js Github

copy

Full Screen

1(function (window){2 var BCHWFontCharacter = function (){3 this.width = 1;4 this.color = new BCHWColor.createRGBAColor();5 this.thickness = 1;6 this.roundedRect;//TODO extend a rect instead of having a property7 };8 9 BCHWFontCharacter.prototype.renderFunction = function(context,character){10 //BCHWFontCharacterRenderer.renderRoundedRectToContext(context,character);11 };12 BCHWFontCharacter.prototype.renderToContext = function(context){13 this.renderFunction(context,this);14 };15 16 BCHWFontCharacter.prototype.addRandomness = function(maxPos,maxScale){17 this.roundedRect.x+=BCHWMathUtil.getRandomNumberInRange(-maxPos,maxPos);18 this.roundedRect.y+=BCHWMathUtil.getRandomNumberInRange(-maxPos,maxPos);19 this.roundedRect.scaleX(1+BCHWMathUtil.getRandomNumberInRange(-maxScale,maxScale));20 this.roundedRect.scaleY(1+BCHWMathUtil.getRandomNumberInRange(-maxScale,maxScale));21 };22 23 BCHWFontCharacter.createBCHWFontCharacter = function (character,color,lineColor,thickness,roundedRect){24 //TODO add Failsafes!25 var fontCharacter = new BCHWFontCharacter();26 fontCharacter.color = color;27 fontCharacter.lineColor = lineColor;28 fontCharacter.thickness = thickness;29 fontCharacter.roundedRect = roundedRect;30 var renderFunction = BCHWFontCharacterRenderer.getRenderFunction(character);31 if(renderFunction){32 fontCharacter.renderFunction=renderFunction;33 }34 fontCharacter.width = BCHWFontCharacterRenderer.getCharacterWidthPercent(character);35 //console.log("BCHWFontCharacter.createBCHWFontCharacter width : "+fontCharacter.width);36 return fontCharacter;37 };38 39 window.BCHWFontCharacter = BCHWFontCharacter;40}(window));41(function (window){42 var BCHWFontCharacterRenderer = function (){};43 //THIS SHOULD BE IN A geom JS File or so44 BCHWFontCharacterRenderer.renderRoundedRectToContext = function(context,character){45 context.beginPath();46 context.lineWidth = character.thickness;47 context.fillStyle = character.color.getCanvasColorString();48 context.strokeStyle = character.lineColor.getCanvasColorString();49 context.moveTo(character.roundedRect.x, character.roundedRect.y+character.roundedRect.radius);50 context.lineTo(character.roundedRect.x, character.roundedRect.y+character.roundedRect.height-character.roundedRect.radius);51 context.quadraticCurveTo( character.roundedRect.x,52 character.roundedRect.y+character.roundedRect.height,53 character.roundedRect.x+character.roundedRect.radius,54 character.roundedRect.y+character.roundedRect.height);55 context.lineTo(character.roundedRect.x+character.roundedRect.width-character.roundedRect.radius,character.roundedRect.y+character.roundedRect.height); 56 context.quadraticCurveTo(character.roundedRect.x+character.roundedRect.width,character.roundedRect.y+character.roundedRect.height,character.roundedRect.x+character.roundedRect.width,character.roundedRect.y+character.roundedRect.height-character.roundedRect.radius); 57 context.lineTo(character.roundedRect.x+character.roundedRect.width,character.roundedRect.y+character.roundedRect.radius); 58 context.quadraticCurveTo(character.roundedRect.x+character.roundedRect.width,character.roundedRect.y,character.roundedRect.x+character.roundedRect.width-character.roundedRect.radius,character.roundedRect.y); 59 context.lineTo(character.roundedRect.x+character.roundedRect.radius,character.roundedRect.y); 60 context.quadraticCurveTo(character.roundedRect.x,character.roundedRect.y,character.roundedRect.x,character.roundedRect.y+character.roundedRect.radius); 61 context.fill();62 context.stroke(); 63 };64 65 66 //bcefghiostuwy67 BCHWFontCharacterRenderer.getRenderFunction = function(character){68 if(!character || character==undefined){69 return null;70 }71 switch(character.toLowerCase()){72 case "b":73 case "c":74 case "e":75 case "f":76 case "g":77 case "h":78 case "i":79 case "m":80 case "o":81 case "r":82 case "s":83 case "t":84 case "u":85 case "w":86 case "y":87 return BCHWFontCharacterRenderer["render"+character.toUpperCase()];88 break;89 }90 return null;91 };92 93 //bcefghiostuwy94 BCHWFontCharacterRenderer.getCharacterWidthPercent = function(character){95 var percent = 1;96 if(!character || character==undefined){97 return percent;98 }99 switch(character.toLowerCase()){100 case "b":101 percent = 1;102 break;103 case "c":104 percent = .9;105 break;106 case "e":107 percent = .8;108 break;109 case "f":110 percent = .8;111 break;112 case "g":113 percent = .9;114 break;115 case "h":116 percent = .9;117 break;118 case "i":119 percent = .5;120 break;121 case "m":122 percent = 1.2;123 break;124 case "o":125 percent = .9;126 break;127 case "r":128 percent = 1;129 break;130 case "s":131 percent = .8;132 break;133 case "t":134 percent = 1;135 break;136 case "u":137 percent = .9;138 break;139 case "w":140 percent = 1.2;141 break;142 case "y":143 percent = 1;144 break;145 }146 return percent;147 };148 BCHWFontCharacterRenderer.renderB = function(context,character){149 BCHWFontCharacterRenderer.renderRoundedRectToContext(context,character);150 context.beginPath();151 context.lineWidth = character.thickness;152 context.strokeStyle = character.lineColor.getCanvasColorString();153 154 var right = character.roundedRect.x+character.roundedRect.width;155 var yMiddle = character.roundedRect.y+character.roundedRect.height/2;156 context.moveTo(right, yMiddle);157 context.lineTo(right-character.roundedRect.width/4,yMiddle);158 159 var fourthHeight=character.roundedRect.height/4;160 context.moveTo(character.roundedRect.x+character.roundedRect.width/2,character.roundedRect.y+fourthHeight);161 context.lineTo(character.roundedRect.x+character.roundedRect.width/2+character.roundedRect.width/4,character.roundedRect.y+fourthHeight);162 163 context.moveTo(character.roundedRect.x+character.roundedRect.width/2,character.roundedRect.y+fourthHeight*3);164 context.lineTo(character.roundedRect.x+character.roundedRect.width/2+character.roundedRect.width/4,character.roundedRect.y+fourthHeight*3);165 166 context.stroke(); 167 };168 BCHWFontCharacterRenderer.renderC=function(context,character){169 BCHWFontCharacterRenderer.renderRoundedRectToContext(context,character);170 context.beginPath();171 context.lineWidth = character.thickness;172 context.strokeStyle = character.lineColor.getCanvasColorString();173 174 var right = character.roundedRect.x+character.roundedRect.width;175 var yMiddle = character.roundedRect.y+character.roundedRect.height/2;176 var xMiddle=character.roundedRect.x+character.roundedRect.width/2;177 context.moveTo(right,yMiddle);178 context.lineTo(xMiddle,yMiddle);179 180 var fourthHeight=character.roundedRect.height/4;181 context.moveTo(xMiddle,character.roundedRect.y+fourthHeight);182 context.lineTo(xMiddle,character.roundedRect.y+fourthHeight*3);183 184 context.stroke(); 185 };186 BCHWFontCharacterRenderer.renderE = function(context,character){187 BCHWFontCharacterRenderer.renderRoundedRectToContext(context,character);188 context.beginPath();189 context.lineWidth=character.thickness;190 context.strokeStyle=character.lineColor.getCanvasColorString();191 192 var right=character.roundedRect.x+character.roundedRect.width;193 var fourthWidth=character.roundedRect.width/4;194 var thirdHeight=character.roundedRect.height/3;195 context.moveTo(right,character.roundedRect.y+thirdHeight);196 context.lineTo(right-fourthWidth,character.roundedRect.y+thirdHeight);197 198 context.moveTo(right,character.roundedRect.y+thirdHeight*2);199 context.lineTo(right-fourthWidth,character.roundedRect.y+thirdHeight*2);200 201 context.stroke(); 202 };203 BCHWFontCharacterRenderer.renderF = function(context,character){204 context.beginPath();205 context.lineWidth=character.thickness;206 context.fillStyle=character.color.getCanvasColorString();207 context.strokeStyle=character.lineColor.getCanvasColorString();208 209 var thirdWidth=character.roundedRect.width/3;210 var thirdHeight=character.roundedRect.height/3;211 var right=character.roundedRect.x+character.roundedRect.width;212 var bottom=character.roundedRect.y+character.roundedRect.height;213 214 context.moveTo(character.roundedRect.x,character.roundedRect.y+character.roundedRect.radius); 215 context.lineTo(character.roundedRect.x,bottom-character.roundedRect.radius); 216 context.quadraticCurveTo(character.roundedRect.x,bottom,character.roundedRect.x+character.roundedRect.radius,character.roundedRect.y+character.roundedRect.height); 217 218 context.lineTo(character.roundedRect.x+thirdWidth*2-character.roundedRect.radius,bottom); 219 context.quadraticCurveTo(character.roundedRect.x+thirdWidth*2,bottom,character.roundedRect.x+thirdWidth*2,bottom-character.roundedRect.radius); 220 221 context.lineTo(character.roundedRect.x+thirdWidth*2,bottom-thirdHeight); 222 context.lineTo(right-character.roundedRect.radius,bottom-thirdHeight);223 context.quadraticCurveTo(right,bottom-thirdHeight,right,bottom-thirdHeight-character.roundedRect.radius);224 225 context.lineTo(character.roundedRect.x+character.roundedRect.width,character.roundedRect.y+character.roundedRect.radius); 226 context.quadraticCurveTo(character.roundedRect.x+character.roundedRect.width,character.roundedRect.y,character.roundedRect.x+character.roundedRect.width-character.roundedRect.radius,character.roundedRect.y); 227 context.lineTo(character.roundedRect.x+character.roundedRect.radius,character.roundedRect.y); 228 context.quadraticCurveTo(character.roundedRect.x,character.roundedRect.y,character.roundedRect.x,character.roundedRect.y+character.roundedRect.radius); 229 context.fill();230 context.stroke();231 context.beginPath();232 context.lineWidth=character.thickness;233 context.strokeStyle=character.lineColor.getCanvasColorString();234 context.moveTo(right,character.roundedRect.y+thirdHeight);235 context.lineTo(right-thirdWidth,character.roundedRect.y+thirdHeight);236 237 context.stroke(); 238 };239 BCHWFontCharacterRenderer.renderG = function(context,character){240 BCHWFontCharacterRenderer.renderRoundedRectToContext(context,character);241 context.beginPath();242 context.lineWidth=character.thickness;243 context.strokeStyle=character.lineColor.getCanvasColorString();244 245 var right=character.roundedRect.x+character.roundedRect.width;246 var halfX=character.roundedRect.x+character.roundedRect.width/2;247 var halfY=character.roundedRect.y+character.roundedRect.height/1.8;248 var fourthWidth=character.roundedRect.width/4;249 var fourthHeight=character.roundedRect.height/4;250 251 context.moveTo(right,halfY);252 context.lineTo(halfX,halfY);253 context.lineTo(halfX,halfY+fourthHeight);254 context.lineTo(halfX+fourthWidth,halfY+fourthHeight);255 context.stroke(); 256 };257 BCHWFontCharacterRenderer.renderH = function(context,character){258 BCHWFontCharacterRenderer.renderRoundedRectToContext(context,character);259 context.beginPath();260 context.lineWidth=character.thickness;261 context.strokeStyle=character.lineColor.getCanvasColorString();262 263 var halfX=character.roundedRect.x+character.roundedRect.width/2;264 var fourthHeight=character.roundedRect.height/4;265 266 context.moveTo(halfX,character.roundedRect.y);267 context.lineTo(halfX,character.roundedRect.y+fourthHeight);268 269 context.moveTo(halfX,character.roundedRect.y+character.roundedRect.height);270 context.lineTo(halfX,character.roundedRect.y+character.roundedRect.height-fourthHeight);271 context.stroke(); 272 };273 BCHWFontCharacterRenderer.renderI = function(context,character){274 BCHWFontCharacterRenderer.renderRoundedRectToContext(context,character);275 };276 BCHWFontCharacterRenderer.renderM = function(context,character){277 BCHWFontCharacterRenderer.renderRoundedRectToContext(context,character);278 context.beginPath();279 context.lineWidth=character.thickness;280 context.strokeStyle=character.lineColor.getCanvasColorString();281 var thirdHeight=character.roundedRect.height/3;282 var thirdWidth=character.roundedRect.width/3;283 context.moveTo(character.roundedRect.x+thirdWidth,character.roundedRect.getBottom());284 context.lineTo(character.roundedRect.x+thirdWidth,character.roundedRect.getBottom()-thirdHeight);285 context.moveTo(character.roundedRect.x+thirdWidth*2,character.roundedRect.getBottom());286 context.lineTo(character.roundedRect.x+thirdWidth*2,character.roundedRect.getBottom()-thirdHeight);287 context.stroke();288 };289 290 BCHWFontCharacterRenderer.renderO = function(context,character){291 BCHWFontCharacterRenderer.renderRoundedRectToContext(context,character);292 context.beginPath();293 context.lineWidth=character.thickness;294 context.strokeStyle=character.lineColor.getCanvasColorString();295 296 var halfX=character.roundedRect.x+character.roundedRect.width/2;297 var thirdHeight=character.roundedRect.height/3;298 299 context.moveTo(halfX,character.roundedRect.y+thirdHeight);300 context.lineTo(halfX,character.roundedRect.y+thirdHeight*2);301 context.stroke(); 302 };303 BCHWFontCharacterRenderer.renderR = function(context,character){304 BCHWFontCharacterRenderer.renderRoundedRectToContext(context,character);305 context.beginPath();306 context.lineWidth = character.thickness;307 context.strokeStyle = character.lineColor.getCanvasColorString();308 var right = character.roundedRect.x+character.roundedRect.width;309 var yMiddle = character.roundedRect.y+character.roundedRect.height/2;310 context.moveTo(right, yMiddle);311 context.lineTo(right-character.roundedRect.width/4,yMiddle);312 var fourthHeight=character.roundedRect.height/4;313 context.moveTo(character.roundedRect.x+character.roundedRect.width/2,character.roundedRect.y+fourthHeight);314 context.lineTo(character.roundedRect.x+character.roundedRect.width/2+character.roundedRect.width/4,character.roundedRect.y+fourthHeight);315 var x = character.roundedRect.x+character.roundedRect.width/2;316 context.moveTo(x, character.roundedRect.getBottom()-fourthHeight);317 context.lineTo(x, character.roundedRect.getBottom());318 context.stroke();319 };320 BCHWFontCharacterRenderer.renderS = function(context,character){321 BCHWFontCharacterRenderer.renderRoundedRectToContext(context,character);322 context.beginPath();323 context.lineWidth=character.thickness;324 context.strokeStyle=character.lineColor.getCanvasColorString();325 var right=character.roundedRect.x+character.roundedRect.width; 326 var thirdWidth=character.roundedRect.width/3;327 var thirdHeight=character.roundedRect.height/3;328 329 context.moveTo(right,character.roundedRect.y+thirdHeight);330 context.lineTo(right-thirdWidth,character.roundedRect.y+thirdHeight);331 context.moveTo(character.roundedRect.x,character.roundedRect.y+thirdHeight*2);332 context.lineTo(character.roundedRect.x+thirdWidth,character.roundedRect.y+thirdHeight*2);333 context.stroke(); 334 };335 BCHWFontCharacterRenderer.renderT = function(context,character){336 context.beginPath();337 context.lineWidth=character.thickness;338 context.fillStyle=character.color.getCanvasColorString();339 context.strokeStyle=character.lineColor.getCanvasColorString();340 var rect=character.roundedRect; 341 var radius=character.roundedRect.radius;342 var thirdWidth=rect.width/3;343 var thirdHeight=rect.height/3;344 var right=rect.x+rect.width;345 var bottom=rect.y+rect.height;346 347 348 context.moveTo(rect.x,rect.y+radius); 349 context.lineTo(rect.x,bottom-thirdHeight-radius);350 context.quadraticCurveTo(rect.x,bottom-thirdHeight,rect.x+radius,bottom-thirdHeight);351 context.lineTo(rect.x+thirdWidth-radius,bottom-thirdHeight); 352 context.quadraticCurveTo(rect.x+thirdWidth,bottom-thirdHeight,rect.x+thirdWidth,bottom-thirdHeight+radius); 353 context.lineTo(rect.x+thirdWidth,bottom-radius);354 context.quadraticCurveTo(rect.x+thirdWidth,bottom,rect.x+thirdWidth+radius,bottom);355 context.lineTo(rect.x+thirdWidth*2-radius,bottom);356 context.quadraticCurveTo(rect.x+thirdWidth*2,bottom,rect.x+thirdWidth*2,bottom-radius);357 context.lineTo(rect.x+thirdWidth*2,bottom-thirdHeight+radius);358 context.quadraticCurveTo(rect.x+thirdWidth*2,bottom-thirdHeight,rect.x+thirdWidth*2+radius,bottom-thirdHeight);359 context.lineTo(right-radius,bottom-thirdHeight);360 context.quadraticCurveTo(right,bottom-thirdHeight,right,bottom-thirdHeight-radius);361 362 context.lineTo(right,rect.y+radius); 363 context.quadraticCurveTo(right,rect.y,right-radius,rect.y); 364 context.lineTo(rect.x+radius,rect.y); 365 context.quadraticCurveTo(rect.x,rect.y,rect.x,rect.y+radius); 366 context.fill();367 context.stroke();368 };369 BCHWFontCharacterRenderer.renderU = function(context,character){370 BCHWFontCharacterRenderer.renderRoundedRectToContext(context,character);371 context.beginPath();372 context.lineWidth=character.thickness;373 context.strokeStyle=character.lineColor.getCanvasColorString();374 375 var halfX=character.roundedRect.x+character.roundedRect.width/2;376 var fourthHeight=character.roundedRect.height/4;377 378 context.moveTo(halfX,character.roundedRect.y);379 context.lineTo(halfX,character.roundedRect.y+fourthHeight);380 381 context.stroke(); 382 };383 BCHWFontCharacterRenderer.renderW = function(context,character){384 BCHWFontCharacterRenderer.renderRoundedRectToContext(context,character);385 context.beginPath();386 context.lineWidth=character.thickness;387 context.strokeStyle=character.lineColor.getCanvasColorString();388 389 var thirdHeight=character.roundedRect.height/3;390 var thirdWidth=character.roundedRect.width/3;391 context.moveTo(character.roundedRect.x+thirdWidth,character.roundedRect.y);392 context.lineTo(character.roundedRect.x+thirdWidth,character.roundedRect.y+thirdHeight);393 394 context.moveTo(character.roundedRect.x+thirdWidth*2,character.roundedRect.y);395 context.lineTo(character.roundedRect.x+thirdWidth*2,character.roundedRect.y+thirdHeight);396 397 context.stroke(); 398 };399 BCHWFontCharacterRenderer.renderY = function(context,character){400 context.beginPath();401 context.lineWidth=character.thickness;402 context.fillStyle=character.color.getCanvasColorString();403 context.strokeStyle=character.lineColor.getCanvasColorString();404 var rect=character.roundedRect; 405 var radius=character.roundedRect.radius;406 var thirdWidth=rect.width/3;407 var thirdHeight=rect.height/3;408 var right=rect.x+rect.width;409 var bottom=rect.y+rect.height;410 411 412 context.moveTo(rect.x,rect.y+radius); 413 context.lineTo(rect.x,bottom-thirdHeight-radius);414 context.quadraticCurveTo(rect.x,bottom-thirdHeight,rect.x+radius,bottom-thirdHeight);415 context.lineTo(rect.x+thirdWidth-radius,bottom-thirdHeight); 416 context.quadraticCurveTo(rect.x+thirdWidth,bottom-thirdHeight,rect.x+thirdWidth,bottom-thirdHeight+radius); 417 context.lineTo(rect.x+thirdWidth,bottom-radius);418 context.quadraticCurveTo(rect.x+thirdWidth,bottom,rect.x+thirdWidth+radius,bottom);419 context.lineTo(rect.x+thirdWidth*2-radius,bottom);420 context.quadraticCurveTo(rect.x+thirdWidth*2,bottom,rect.x+thirdWidth*2,bottom-radius);421 context.lineTo(rect.x+thirdWidth*2,bottom-thirdHeight+radius);422 context.quadraticCurveTo(rect.x+thirdWidth*2,bottom-thirdHeight,rect.x+thirdWidth*2+radius,bottom-thirdHeight);423 context.lineTo(right-radius,bottom-thirdHeight);424 context.quadraticCurveTo(right,bottom-thirdHeight,right,bottom-thirdHeight-radius);425 426 context.lineTo(right,rect.y+radius); 427 context.quadraticCurveTo(right,rect.y,right-radius,rect.y); 428 context.lineTo(rect.x+radius,rect.y); 429 context.quadraticCurveTo(rect.x,rect.y,rect.x,rect.y+radius); 430 context.fill();431 context.stroke();432 433 context.beginPath();434 context.lineWidth=character.thickness;435 context.strokeStyle=character.lineColor.getCanvasColorString();436 437 var halfX = rect.x+rect.width/2;438 var fourthHeight = rect.height/4;439 440 context.moveTo(halfX,rect.y);441 context.lineTo(halfX,rect.y+fourthHeight);442 443 context.stroke(); 444 };445 446 window.BCHWFontCharacterRenderer = BCHWFontCharacterRenderer;...

Full Screen

Full Screen

roundedrect.js

Source:roundedrect.js Github

copy

Full Screen

1goog.provide('lime.Renderer.CANVAS.ROUNDEDRECT');2goog.provide('lime.Renderer.DOM.ROUNDEDRECT');3goog.provide('lime.RoundedRect');4goog.require('lime.Renderer.CANVAS.SPRITE');5goog.require('lime.Renderer.DOM.SPRITE');6goog.require('lime.Sprite');7goog.require('lime.style');8/**9 * Rounded rectangle10 * @constructor11 * @extends lime.Sprite12 */13lime.RoundedRect = function() {14 lime.Sprite.call(this);15 this.setRadius(5);16};17goog.inherits(lime.RoundedRect, lime.Sprite);18/**19 * Common name for RoundedRect objects20 * @type {string}21 */22lime.RoundedRect.prototype.id = 'roundedrect';23/** @inheritDoc */24lime.RoundedRect.prototype.supportedRenderers = [25 lime.Renderer.DOM.SPRITE.makeSubRenderer(lime.Renderer.DOM.ROUNDEDRECT),26 lime.Renderer.CANVAS.SPRITE.makeSubRenderer(lime.Renderer.CANVAS.ROUNDEDRECT)27];28/**29 * Return corner radius30 * @return {number} Radius.31 */32lime.RoundedRect.prototype.getRadius = function() {33 return this.radius_;34};35/**36 * Return true if radius is in percentage units37 * @return {boolean} Unit is percentage?38 */39lime.RoundedRect.prototype.getUnitPercentage = function() {40 return this.unitPercentage_;41};42/**43 * Sets the corner radius for object44 * @param {number} value Radius.45 * @param {boolean=} opt_percentage use percentage units.46 */47lime.RoundedRect.prototype.setRadius = function(value, opt_percentage) {48 this.unitPercentage_ = opt_percentage || false;49 this.radius_ = value;50 return this;51};52/**53 * @inheritDoc54 * @this {lime.RoundedRect}55 */56lime.Renderer.DOM.ROUNDEDRECT.draw = function(el) {57 var size = this.getSize();58 lime.Renderer.DOM.SPRITE.draw.call(this, el);59 lime.style.setBorderRadius(el, [this.radius_*this.getQuality(), this.radius_*this.getQuality()]);60};61/**62 * @inheritDoc63 * @this {lime.RoundedRect}64 */65lime.Renderer.CANVAS.ROUNDEDRECT.draw = function(context) {66 //http://js-bits.blogspot.com/2010/07/canvas-rounded-corner-rectangles.html67 var size = this.getSize(),68 fill = this.getFill(),69 frame = this.getFrame(),70 radius = this.getRadius(),71 x = frame.left,72 y = frame.top,73 width = frame.right - frame.left,74 height = frame.bottom - frame.top;75 context.save();76 context.beginPath();77 context.moveTo(x + radius, y);78 context.lineTo(x + width - radius, y);79 context.quadraticCurveTo(x + width, y, x + width, y + radius);80 context.lineTo(x + width, y + height - radius);81 context.quadraticCurveTo(x + width, y + height,82 x + width - radius, y + height);83 context.lineTo(x + radius, y + height);84 context.quadraticCurveTo(x, y + height, x, y + height - radius);85 context.lineTo(x, y + radius);86 context.quadraticCurveTo(x, y, x + radius, y);87 context.closePath();88 context.clip();89 lime.Renderer.CANVAS.SPRITE.draw.call(this, context);90 91 if(this.stroke_){92 context.lineWidth*=2;93 context.stroke();94 }95 96 context.restore();...

Full Screen

Full Screen

rounded-rect.js

Source:rounded-rect.js Github

copy

Full Screen

...8 ctx.strokeStyle = '#0000ff';9 ctx.lineWidth = 4;10 ctx.fillStyle = '#00ff00';11 ctx.beginPath();12 roundedRect(ctx, 10, 10, 50, 50, 25);13 roundedRect(ctx, 70, 10, 100, 50, 25);14 roundedRect(ctx, 10, 70, 50, 100, 25);15 roundedRect(ctx, 70, 70, 100, 100, 25);16 roundedRect(ctx, 180, 10, 50, 50, 100);17 roundedRect(ctx, 240, 10, 100, 50, 100);18 roundedRect(ctx, 180, 70, 50, 100, 100);19 roundedRect(ctx, 240, 70, 100, 100, 100);20 roundedRect(ctx, 350, 10, 50, 50, 0);21 ctx.fill();22 ctx.stroke();23 }24 }],25 options: {26 scales: {27 xAxes: [{display: false}],28 yAxes: [{display: false}]29 }30 }31 },32 options: {33 canvas: {34 height: 256,...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { roundedRect } from 'storybook-root';2import { roundedRect } from 'storybook-root';3import { roundedRect } from 'storybook-root';4import { roundedRect } from 'storybook-root';5import { roundedRect } from 'storybook-root';6import { roundedRect } from 'storybook-root';7import { roundedRect } from 'storybook-root';8import { roundedRect } from 'storybook-root';9import { roundedRect } from 'storybook-root';10import { roundedRect } from 'storybook-root';11import { roundedRect } from 'storybook-root';12import { roundedRect } from 'storybook-root';13import { roundedRect } from 'storybook-root';14import { roundedRect } from 'storybook-root';15import { roundedRect } from 'storybook-root';16import { roundedRect } from 'storybook-root';17import { roundedRect } from 'storybook-root';18import { roundedRect } from 'storybook-root';19import { roundedRect } from 'storybook-root';20import { roundedRect } from 'storybook-root';

Full Screen

Using AI Code Generation

copy

Full Screen

1storyboard.roundedRect(20, 20, 100, 100, 10, 10);2storyboard.roundedRect(20, 20, 100, 100, 10, 10);3storyboard.roundedRect(20, 20, 100, 100, 10, 10);4storyboard.roundedRect(20, 20, 100, 100, 10, 10);5storyboard.roundedRect(20, 20, 100, 100, 10, 10);6storyboard.roundedRect(20, 20, 100, 100, 10, 10);7storyboard.roundedRect(20, 20, 100, 100, 10, 10);8storyboard.roundedRect(20, 20, 100, 100, 10, 10);9storyboard.roundedRect(20, 20, 100, 100, 10, 10);10storyboard.roundedRect(20, 20, 100, 100, 10, 10);11storyboard.roundedRect(20, 20, 100, 100, 10, 10);12storyboard.roundedRect(20, 20, 100, 100, 10, 10);

Full Screen

Using AI Code Generation

copy

Full Screen

1import { roundedRect } from 'storybook-root';2roundedRect(10, 10, 100, 100, 20);3import { roundedRect } from 'storybook-root';4roundedRect(10, 10, 100, 100, 20);5import { roundedRect } from 'storybook-root';6roundedRect(10, 10, 100, 100, 20);7import { roundedRect } from 'storybook-root';8roundedRect(10, 10, 100, 100, 20);9import { roundedRect } from 'storybook-root';10roundedRect(10, 10, 100, 100, 20);11import { roundedRect } from 'storybook-root';12roundedRect(10, 10, 100, 100, 20);13import { roundedRect } from 'storybook-root';14roundedRect(10, 10, 100, 100, 20);15import { roundedRect } from 'storybook-root';16roundedRect(10, 10, 100, 100, 20);17import { roundedRect } from 'storybook-root';18roundedRect(10, 10, 100, 100, 20);19import { roundedRect } from 'storybook-root';20roundedRect(10, 10, 100, 100, 20);21import { roundedRect } from 'storybook-root';22roundedRect(10, 10, 100, 100, 20);23import { roundedRect

Full Screen

Using AI Code Generation

copy

Full Screen

1import { roundedRect } from 'storybook-root';2roundedRect(10, 10, 100, 100, 10, 10);3export const roundedRect = (x, y, width, height, radius, radius2) => {4};5export const roundedRect = (x, y, width, height, radius, radius2) => {6};7export const roundedRect = (x, y, width, height, radius, radius2) => {8};9export const roundedRect = (x, y, width, height, radius, radius2) => {10};11export const roundedRect = (x, y, width, height, radius, radius2) => {12};13export const roundedRect = (x, y, width, height, radius, radius2) => {14};15export const roundedRect = (x, y, width, height, radius, radius2) => {16};17export const roundedRect = (x, y, width, height, radius, radius2) => {18};19export const roundedRect = (x, y, width, height, radius, radius2) => {20};21export const roundedRect = (x, y, width, height, radius, radius2) => {22};23export const roundedRect = (x, y, width, height, radius, radius2) => {24};

Full Screen

Using AI Code Generation

copy

Full Screen

1import { roundedRect } from 'storybook-root'2export { roundedRect } from './roundedRect'3export function roundedRect() {4}5module.exports = {6 moduleNameMapper: {7 },8}9{10 "paths": {11 },12}13{14 "jest": {15 "moduleNameMapper": {16 }17 }18}19module.exports = {20 moduleNameMapper: {21 },22}

Full Screen

Using AI Code Generation

copy

Full Screen

1const storybookRoot = require('storybook-root');2const roundedRect = storybookRoot.roundedRect;3module.exports = {4};5function roundedRect (x, y, width, height, radius) {6}7const roundedRect = require('storybook-root').roundedRect;8exports.roundedRect = roundedRect;9function roundedRect (x, y, width, height, radius) {10}11const {roundedRect} = require('storybook-root');12module.exports = {13};14function roundedRect (x, y, width, height, radius) {15}16const {roundedRect} = require('storybook-root');17exports.roundedRect = function (x, y, width, height, radius) {18};19const roundedRect = require('storybook-root').roundedRect;20exports.roundedRect = function (x, y, width, height, radius) {21};22const roundedRect = require('storybook-root').roundedRect;

Full Screen

Using AI Code Generation

copy

Full Screen

1import { roundedRect } from 'storybook-root';2const test = () => {3 roundedRect();4}5test();6const roundedRect = () => {7 console.log('roundedRect');8}9export { roundedRect };

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 storybook-root automation tests on LambdaTest cloud grid

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

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful