Sie sind nicht angemeldet.

1

Dienstag, 22. Juni 2021, 02:02

CSS Gradient as background color for Layer

Is it possible to use a css gradient as a background color on a layer?

Something like: background: linear-gradient(45deg, #FFFFFF 0%, #000000 100%);

Beiträge: 141

Wohnort: Russia, Komi republic, Uhta

Beruf: developer

  • Nachricht senden

2

Dienstag, 22. Juni 2021, 08:37

I don't know how to do it in xml, but using JavaScript in the plugin, you can do it like this:

Quellcode

1
2
3
4
5
let t = document.createElement('div');
t.id = 'test'
t.innerHTML = 'this is Test layer';
t.style.cssText = 'background: linear-gradient(45deg, #FF0000 0%, #00000000 100%); width:150px; height:25px;'
plugin.sprite.appendChild(t);

Hello from uhta3d )))
I'm in telegram: Lastromantik