-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ease invert and reverse and fix cover
- Loading branch information
Showing
7 changed files
with
72 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#lang sweet-exp racket/base | ||
|
||
require racket/contract/base | ||
|
||
provide | ||
contract-out | ||
ease-invert (case-> (-> proper-ease/c proper-ease/c) | ||
(-> ease/c ease/c)) | ||
ease-reverse (case-> (-> proper-ease/c proper-ease/c) | ||
(-> ease/c ease/c)) | ||
|
||
require "base.rkt" | ||
|
||
module+ test | ||
require fancy-app | ||
rackunit | ||
|
||
|
||
module+ test | ||
(define (quadratic-ease-in x) (* x x)) | ||
|
||
|
||
(define ((ease-invert easing) x) | ||
(- 1 (easing (- 1 x)))) | ||
|
||
module+ test | ||
(check-equal? (ease-real (ease-invert quadratic-ease-in) 0 100 5) | ||
(reverse (map (- 100 _) (ease-real quadratic-ease-in 0 100 5)))) | ||
|
||
|
||
(define ((ease-reverse easing) x) | ||
(easing (- 1 x))) | ||
|
||
module+ test | ||
(check-equal? (ease-real (ease-reverse quadratic-ease-in) 0 100 5) | ||
(reverse (ease-real quadratic-ease-in 0 100 5))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#lang scribble/manual | ||
|
||
@(require "util/doc.rkt") | ||
|
||
|
||
@defproc[(ease-invert [easing ease/c]) ease/c]{ | ||
Returns an easing that is like @racket[easing], but | ||
with proportional changes inverted from @racket[easing]. | ||
@ease-examples[ | ||
(define (quadratic-ease x) (* x x)) | ||
(ease-real quadratic-ease 0 100 5) | ||
(ease-real (ease-invert quadratic-ease) 0 100 5) | ||
]} | ||
|
||
@defproc[(ease-reverse [easing ease/c]) ease/c]{ | ||
Returns an easing that is like @racket[easing], but | ||
with it's steps reversed. | ||
@ease-examples[ | ||
(ease-real linear-ease 0 100 5) | ||
(ease-real (ease-reverse linear-ease) 0 100 5) | ||
]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,10 @@ | |
|
||
require | ||
"base.rkt" | ||
"invert.rkt" | ||
|
||
|
||
provide | ||
all-from-out | ||
"base.rkt" | ||
"invert.rkt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters