|
The fx package has functions for working with alpha fades.
|

package main
|
|
|
import (
"github.com/shasderias/ilysa"
"github.com/shasderias/ilysa/beatsaber"
"github.com/shasderias/ilysa/colorful"
"github.com/shasderias/ilysa/colorful/gradient"
"github.com/shasderias/ilysa/context"
"github.com/shasderias/ilysa/ease"
"github.com/shasderias/ilysa/evt"
"github.com/shasderias/ilysa/fx"
"github.com/shasderias/ilysa/light"
"github.com/shasderias/ilysa/timer"
"github.com/shasderias/ilysa/transform"
)
|
|
|
var (
Red = colorful.MustParseHex("#FF0000")
Green = colorful.MustParseHex("#00FF00")
Blue = colorful.MustParseHex("#0000FF")
RGBGrad = gradient.New(Red, Blue, Green)
)
|
|
|
func main() {
m, _ := beatsaber.NewMockMap(beatsaber.EnvironmentOrigins, 120, "[]")
p := ilysa.New(m)
|
|
|
l := transform.Light(light.NewBasic(p, evt.BackLasers),
transform.DivideSingle(),
)
|
|
Save the event(s) generated by fx.ColorSweep() to e.
|
p.Range(timer.Rng(2, 3, 10, ease.Linear), func(ctx context.Context) {
ctx.Light(l, func(ctx context.LightContext) {
|
|
|
e := fx.ColorSweep(ctx, 0.2, RGBGrad)
|
|
fx.AlphaFade() fades e from alpha 1 (at beat 2) to alpha 0
at beat 3.
|
fx.AlphaFade(ctx, e, 1, 0, ease.Linear)
|
|
fx.AlphaFadeEx() works the similarly to fx.AlphaFade(), but
offers more control. In this example, we fade alpha 0 to alpha 2,
starting at t = 0 (beat 2) and ending at t = 0.5 (beat 2.5).
|
fx.AlphaFadeEx(ctx, e, 0, 0.5, 0, 2, ease.Linear)
})
})
}
|