Skip to contents

This helper describes a monotone alpha change along the segment from alpha_1 (at x_1) to alpha_2 (at x_2). gamma controls how quickly the transition happens (larger values concentrate the change towards one end).

Usage

style_segment_alpha_gradient(alpha_1, alpha_2, gamma = 1, n = 300)

Arguments

alpha_1

Alpha at x_1 (segment start), single numeric value between 0 and 1.

alpha_2

Alpha at x_2 (segment end), single numeric value between 0 and 1.

gamma

Positive exponent controlling the alpha curve. gamma > 1 concentrates the change towards x_2 (flatter near x_1), while gamma < 1 concentrates the change towards x_1 (steeper near x_1).

n

Number of interpolation points when using ggforce::geom_link().

Value

A named list with elements alpha_1, alpha_2, gamma, n.

Examples

# More transparent at x_1 and less transparent at x_2
style_segment_alpha_gradient(alpha_1 = 0.1, alpha_2 = 0.6, gamma = 1.4)
#> $alpha_1
#> [1] 0.1
#> 
#> $alpha_2
#> [1] 0.6
#> 
#> $gamma
#> [1] 1.4
#> 
#> $n
#> [1] 300
#>