Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
34 lines (28 sloc) 1.09 KB
(module
tween *
(import scheme chicken)
(define factorial* (make-vector 1 1))
(define (factorial n)
(assert (and (exact? n)
(vector? factorial*)))
(when (>= n (vector-length factorial*))
(set! factorial* (vector-resize factorial* (+ n 1) #f)))
(when (and (<= 1 n) (not (vector-ref factorial* n)))
(set! (vector-ref factorial* n) (* n (factorial (- n 1)))))
(if (>= 1 n) 1
(vector-ref factorial* n)))
(define (rationalize count value #!optional (epsilon 0))
(let ((f (expt 10 count))
(n (+ value epsilon)))
(+ (truncate n)
(/ (truncate (* (- n (truncate n)) f)) f))))
(define (tween easing-function direction start stop percent)
(assert (and (<= 0 percent) (>= 1 percent)
(number? start) (number? stop)))
(+ (* (easing-function direction percent) (- stop start)) start))
(define (interpolate selector-function value-vector percent)
(assert (and (<= 0 percent) (>= 1 percent)
(vector? value-vector)))
(selector-function value-vector percent))
(include "selectors")
(include "easing"))
Something went wrong with that request. Please try again.