Hey Aaron,

Bardo interpolators are meant to be able to handle the transition case that 
you’re talking about, although the semantics for doing so are still relatively 
low level and thus not the easiest thing to understand. 

The om example in the repo does exactly what you’re talking about. 
https://github.com/pleasetrythisathome/bardo/blob/master/examples/om.cljs#L34 
<https://github.com/pleasetrythisathome/bardo/blob/master/examples/om.cljs#L34>

Essentially,mMixes between interpolators that represent overlapping time 
domains can be mixed by shifting the domains of the interpolators. Here’s a 
more step by step explanation.

(def a 0)
(def b 10)
(def intrpl (interpolate a b))
(map intrpl [0 0.5 1])
;; => (0 5.0 10)
;; => (fn [t]) : t [0 -> 1] : a -> b

;; interrupt at dt and interpolate to c
(def dt 0.6)
(def c 50)
(def dintrpl (interpolate (intrpl dt) c))
(map dintrpl [0 0.5 1])
;; => (6.0 28.0 50.0)
;; (fn [t]) : t [0 -> 1] : (intrpl dt) -> c

;; to mix, we need to shift the domain of the input to intrpl
(def sintrpl (ease/shift intrpl 0 (- 1 dt) dt 1))
(map sintrpl [0 (- 1 dt) 1])
;; => (6.0 10.0 16.0)
;; we get a higher output at 1 because we've extended the domain
;; (fn [t]) ; t [0 -> (- 1 dt)] : (intrpl dt) -> b
(-> identity
    (ease/shift 0 (- 1 dt) dt 1)
    (map [0 (- 1 dt) 1]))
;; => (0.6 1.0 1.6)

(def mixed (mix sintrpl dintrpl))
(map mixed [0 0.25 0.5 0.75 1])
;; => (6.0 10.625 19.5 32.625 50.0)

Does that make sense?

I added this to the readme, but a more thorough blog post exploring more of the 
possibilities here is probably in order. 

I’m still exploring the interaction points myself. I plan on writing some more 
composition helper functions that help simplify these operations.

> On Dec 17, 2014, at 10:30 PM, Aaron Craelius <[email protected]> wrote:
> 
> Looks good... I've updated freactive's README to reference bardo's easing 
> functions.
> 
> I want to make sure people can use bardo's interpolators as well with some 
> overload of freactive's start-easing!. I'm wondering how (or if) to handle 
> the case where an animation in progress is interrupted and then sent in a 
> different direction (which freactive currently has some basic naive support 
> for). I don't know if you might have any thoughts on how best to deal with 
> this case in general and/or how it might or might not be possible to do with 
> bardo's interpolators? For an example of what I'm talking about you can see 
> in freactive's little demo that it's possible to interrupt the animation in 
> progress and it guesses (linearly) about the correct speed.
> 
> -- 
> Note that posts from new members are moderated - please be patient with your 
> first post.
> --- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "ClojureScript" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/clojurescript/JROUw58NPX0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/clojurescript.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to