Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2015
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. ;; add a brush that blends by lightening the color
  2. (add-linear-brush
  3. :transparent2
  4. {:blend {:from "ONE" :to "ONE"}
  5. :vertex-shader {(g/gl-position) default-vertex-position
  6. v-value a-value}
  7. :fragment-shader
  8. {(g/gl-frag-color) (g/vec4 u-color 1)}})
  9.  
  10. ;; save where the stroke started (needed for sin wave)
  11. (set! stroke-started
  12. (fn [point]
  13. (swap! app-state assoc :start-point point)))
  14.  
  15. ;; make a sin wave
  16. (set! constrain-stroke
  17. (fn [point dir]
  18. (let [p (geom/+ point (v/vec2 (nth dir 0) 0))]
  19. (v/vec2 (nth p 0)
  20. (+ (nth (:start-point @app-state) 1)
  21. (* (.sin js/Math (/ (nth p 0) 50)) 30))
  22. ))))
  23.  
  24. ;; lock to the x-axis
  25. (set! constrain-stroke
  26. (fn [point dir]
  27. (geom/+ point (v/vec2 (nth dir 0) 0))))
  28.  
  29. (repl-swap! :current-brush :transparent2)
  30. (repl-swap! :background-color "#b0ccbb")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement