This is a SCRIPT-8 cassette.
Created
July 23, 2020 14:16
-
-
Save thykka/542dafb3abcfef3d718ca30c5fa9cee2 to your computer and use it in GitHub Desktop.
SCRIPT-8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| init = state => { | |
| const rndCount = (Math.random() * 8 | 0) + 2 | |
| state.path1 = randomPath(rndCount) | |
| state.path2 = randomPath(rndCount) | |
| } | |
| function randomPath(points) { | |
| return range(0, points).map(_ => ([Math.random() * 128 | 0, Math.random() * 128 | 0])) | |
| } | |
| update = (state, input, elapsed) => { | |
| state.path1.forEach((point, i) => { | |
| point[0] += Math.random() - 0.5 | |
| point[1] += Math.random() - 0.5 | |
| state.path2[i][0] += Math.random() - 0.5 | |
| state.path2[i][1] += Math.random() - 0.5 | |
| }) | |
| if(input.startPressed) { init(state) } | |
| } | |
| draw = state => { | |
| clear() | |
| polyStroke(state.path1, 0) | |
| const paths = 16 | |
| for(let pathIndex = 0; pathIndex < paths; pathIndex++) { | |
| polyStroke(state.path1.map((point, pointIndex) => ([ | |
| lerp(point[0], state.path2[pointIndex][0], pathIndex / paths), | |
| lerp(point[1], state.path2[pointIndex][1], pathIndex / paths) | |
| ])), pathIndex / paths * 7 | 0) | |
| } | |
| polyStroke(state.path2, 6) | |
| } | |
| function lerp(a, b, f) { | |
| return (a * (1 - f)) + (b * f); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "iframeVersion": "0.1.280", | |
| "lines": [ | |
| 36, | |
| 0, | |
| 0, | |
| 0, | |
| 0, | |
| 0, | |
| 0, | |
| 0 | |
| ] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment