Skip to content

Commit

Permalink
Add util methods
Browse files Browse the repository at this point in the history
  • Loading branch information
igr committed Mar 17, 2024
1 parent cbe9954 commit a7f7577
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ gënérative ȧrt made by pragmatic [micro-framework](gartwork/README.md) and
follow: [🎇 Instagram](https://www.instagram.com/gart_173) |
[🎥 YouTube gallery](https://www.youtube.com/watch?v=wbcpgElKq7E&list=PLKevVk1K8oXF_GrdsGHjeOuuSkpZXq5ps)

⚠️ As the library grows, it changes. Some code probably needs to be updated. I don't have time to maintain everything.
🤷‍♂️

## 🍭 gȧlléry

⭐️ [Zen. Plasma. Watter.](arts/plasma/README.md) [🎬](https://youtu.be/wbcpgElKq7E)
Expand Down
12 changes: 12 additions & 0 deletions gartwork/src/main/kotlin/dev/oblac/gart/Frames.kt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,18 @@ interface Frames {
}
}

fun onBeforeFrame(targetFrame: Long, callback: () -> Unit) {
if (new && frame < targetFrame) {
callback()
}
}

fun onAfterFrame(targetFrame: Long, callback: () -> Unit) {
if (new && frame > targetFrame) {
callback()
}
}

fun onEveryFrame(targetFrame: Long, callback: () -> Unit) {
if (new && frame % targetFrame == 0L) {
callback()
Expand Down
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ include 'arts:flowforce'
include 'arts:repetition'
include 'arts:rects'
include 'arts:metro'
//include 'arts:cotton'

0 comments on commit a7f7577

Please sign in to comment.