A fast tween library for arcadia/Unity
timeline starts a coroutine that iterates a seq? collection. Items are invoked every frame and lazily iterate when falsey.
(timeline [
#(log "hello")
(wait 1.0)
#(log "goodbye")])timeline-1 uses another fn layer to provide an initialization closure. This closure is needed to repeat wait and tween fns.
(timeline-1
(cycle [
(fn [] (wait (rand)))
(fn [] #(log 'tick)])))timeline* macro wraps forms with (fn []), and uses an Array for performance. Keywords are removed for options. :loop cycles the iterator.
(timeline* :loop
(wait 0.5)
(tween {:local {:scale (->v3 (rand))}}
(the ball) 0.9))(wait 0.5)
returns fn that returns true for the duration after it's first invokation
Registers a type for tweening. An internal Pair-Foo class will be defined.
(deftag UnityEngine.Vector3
{:lerp UnityEngine.Vector3/Lerp
:identity (UnityEngine.Vector3.)})(deftween [:material :color] [this]
{:get (.color this)
:tag UnityEngine.Color
:base (.material (.GetComponent this UnityEngine.Renderer))
:base-tag UnityEngine.Material})register an edn path as a tween. The path is arbitrary and the symbol binding will be to a user provided object.
arg-1edn patharg-2vector with symbol used in getter codearg-3map with::tagqualified type of property (should be registered with deftag):getcode to get tweenable property:baseoptional getter for derived object:base-tagoptional type-hint for base object
Expands into a fn that returns true for the duration after it's first invokation. The target map is exploded into paths, a path registered with deftween will expand into code.
(tween
{:local
{:scale (Vector3. 2.0 2.0 2.0)
:position (Vector3. 0.0 2.0 0.0)}}
(GameObject.)
2.5 {:in :pow5})arg-1map of target valuesarg-2object referencearg-3duration& morecompile into opt map
{:in :pow3}
- keys
:in:out - vals
:pow2:pow3:pow4:pow5nil
