+ Reply to Thread
Results 1 to 3 of 3

Thread: Need help with Canvas

  1. #1
    Rift Chaser Lifeismystery's Avatar
    Join Date
    Dec 2010
    Posts
    341

    Default Need help with Canvas

    Can someone help me with type = "gradientLinear" in Canvas?

    http://i.imgur.com/jOy56qR.jpg

    I need no do that Harmony will be in then middle, but i don't know how. When i change bar size gradient color don't change position.

    Code:
    primalistBar.canvasSettings.fill = {
    			type = "gradientLinear",  
    			--transform = {1, 0, 0, 0, 1, 0},
    			color = {
    			{r = primalistBar.colorFury[1], g = primalistBar.colorFury[2], b = primalistBar.colorFury[3], a = primalistBar.colorFury[4], 	position = 0},
    			{r = primalistBar.colorHarmony[1], g = primalistBar.colorHarmony[2], b = primalistBar.colorHarmony[3], a = primalistBar.colorHarmony[4], 	position = 0.5},
    			{r = primalistBar.colorHarmony[1], g = primalistBar.colorHarmony[2], b = primalistBar.colorHarmony[3], a = primalistBar.colorHarmony[4], 	position = 0.6},
    			{r = primalistBar.colorCunning[1], g = primalistBar.colorCunning[2], b = primalistBar.colorCunning[3], a = primalistBar.colorCunning[4], 	position = 1},
    			}
    		}
    All code here https://yadi.sk/d/nQGsn3Yyji2DZ

  2. #2
    General of Telara
    Join Date
    Mar 2014
    Posts
    967

    Default

    Haven't used gradients yet, only textures, but from the API docs, gradients are by default 100 "units" (i.e. pixels without UI scaling in effect) wide, so you just need to adjust your transformation matrix accordingly.

    Instead of {1, 0, 0, 0, 1, 0}, use { primalistBar:GetWidth()/100, 0, 0, 0, 1, 0 }
    Alternatively you can also use Utility.Matrix.Create() and pass scaleX accordingly, but unless you want to rotate, it really just determines the first matrix value.

  3. #3
    Rift Chaser Lifeismystery's Avatar
    Join Date
    Dec 2010
    Posts
    341

    Default

    Thank you mate, it work

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts