(gradient: LinearGradient)
| 13 | } |
| 14 | |
| 15 | function fromGradient(gradient: LinearGradient): org.nativescript.widgets.LinearGradientDefinition { |
| 16 | const colors = Array.create('int', gradient.colorStops.length); |
| 17 | const stops = Array.create('float', gradient.colorStops.length); |
| 18 | let hasStops = false; |
| 19 | gradient.colorStops.forEach((stop, index) => { |
| 20 | colors[index] = stop.color.android; |
| 21 | if (stop.offset) { |
| 22 | stops[index] = stop.offset.value; |
| 23 | hasStops = true; |
| 24 | } |
| 25 | }); |
| 26 | |
| 27 | const alpha = gradient.angle / (Math.PI * 2); |
| 28 | const startX = Math.pow(Math.sin(Math.PI * (alpha + 0.75)), 2); |
| 29 | const startY = Math.pow(Math.sin(Math.PI * (alpha + 0.5)), 2); |
| 30 | const endX = Math.pow(Math.sin(Math.PI * (alpha + 0.25)), 2); |
| 31 | const endY = Math.pow(Math.sin(Math.PI * alpha), 2); |
| 32 | |
| 33 | return new org.nativescript.widgets.LinearGradientDefinition(startX, startY, endX, endY, colors, hasStops ? stops : null); |
| 34 | } |
| 35 | |
| 36 | const pattern = /url\(('|")(.*?)\1\)/; |
| 37 | export function refreshBorderDrawable(view: View, borderDrawable: org.nativescript.widgets.BorderDrawable) { |
no test coverage detected