Add simple wipe effect for undo.

This commit is contained in:
David Thompson 2024-05-23 12:06:42 -04:00
parent 98ae464ab9
commit aa8a302fcb
2 changed files with 12 additions and 4 deletions

View file

@ -108,7 +108,8 @@
((snapshot . older-snapshots)
(set! *actormap* snapshot)
(set! *snapshots* older-snapshots)
(play-sound-effect audio:undo))))
(play-sound-effect audio:undo)
(show-effect! (make-wipe-effect 0.25)))))
(define (sort lst compare)
(match lst

View file

@ -16,7 +16,8 @@
draw-effect
make-fade-out+in-effect
make-screen-shake-effect))
make-screen-shake-effect
make-wipe-effect))
(define (ease:smoothstep t)
(* t t (- 3 (* 2 t))))
@ -61,8 +62,8 @@
(define (make-fade-out+in-effect duration)
(define (draw context t)
(if (< t 0.5)
(set-global-alpha! context (pk 'alpha-out (* t 2.0)))
(set-global-alpha! context (pk 'alpha-in (- 1.0 (* (- t 0.5) 2.0)))))
(set-global-alpha! context (* t 2.0))
(set-global-alpha! context (- 1.0 (* (- t 0.5) 2.0))))
(set-fill-color! context "#000000")
(fill-rect context 0.0 0.0 game-width game-height)
(set-global-alpha! context 1.0))
@ -74,3 +75,9 @@
(y (round (random))))
(translate! context x y)))
(make-effect 'pre duration draw))
(define (make-wipe-effect duration)
(define (draw context t)
(set-fill-color! context "#222034")
(fill-rect context 0.0 0.0 (* game-width (- 1.0 t)) game-height))
(make-effect 'post duration draw))