Quantcast
Viewing all articles
Browse latest Browse all 8068

Gradient Background Colors

How do I count these offset values up by .01 without writing it with 1000 lines of code?

var linearGradient = Ti.UI.createView({
    top: 10,
    width: 100,
    height: 100,
    backgroundGradient: {
        type: 'linear',
        startPoint: { x: '50%', y: '0%' },
        endPoint: { x: '50%', y: '100%' },
        colors: [ { color: '#GREEN', offset: 0.0}, { color: '#YELLOW', offset: 0.01 }, { color: '#GREEN', offset: 0.02 }, 
                  { color: '#GREEN', offset: 0.03},{ color: '#YELLOW', offset: 0.04 }, { color: '#GREEN', offset: 0.05 }, ],
    }
});
I'm looking to create some sort of function or if statement to count the offset values up by .01. I'd imagine green would be executed in increments of .02 counting from .00. And Yellow would be executed in .03 counting from .01.

P.S I'd like to make these lines vertical instead of horizontal

Thank you!


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>