-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
194 lines (169 loc) · 8.32 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="Winamp AVS mode for CodeMirror 5" />
<title>Demo | @visbot/codemirror-avs</title>
<style>/*! tailwindcss v2.1.1 | MIT License | https://tailwindcss.com *//*! modern-normalize v1.0.0 | MIT License | https://github.com/sindresorhus/modern-normalize */*,::after,::before{box-sizing:border-box}:root{-moz-tab-size:4;tab-size:4}html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}body{font-family:system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"}textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}h1,p{margin:0}html{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";line-height:1.5}body{font-family:inherit;line-height:inherit}*,::after,::before{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}textarea{resize:vertical}h1{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}textarea{padding:0;line-height:inherit;color:inherit}.container{width:100%}@media(min-width:640px){.container{max-width:640px}}@media(min-width:768px){.container{max-width:768px}}@media(min-width:1024px){.container{max-width:1024px}}@media(min-width:1280px){.container{max-width:1280px}}@media(min-width:1536px){.container{max-width:1536px}}.block{display:block}.flex{display:flex}.flex-col{flex-direction:column}.justify-center{justify-content:center}.font-sans{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"}.h-screen{height:100vh}.font-semibold{font-weight:600}.text-base{font-size:1rem;line-height:1.5rem}.text-2xl{font-size:1.5rem;line-height:2rem}.mx-5{margin-left:1.25rem;margin-right:1.25rem}.mx-auto{margin-left:auto;margin-right:auto}.mt-3{margin-top:.75rem}.mt-8{margin-top:2rem}.p-4{padding:1rem}*{--tw-shadow:0 0 #0000}*{--tw-ring-inset:var(--tw-empty);/*!*//*!*/--tw-ring-offset-width:0;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000}.text-center{text-align:center}.text-gray-500{--tw-text-opacity:1;color:rgba(107,114,128,var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity:1;color:rgba(17,24,39,var(--tw-text-opacity))}.text-indigo-600{--tw-text-opacity:1;color:rgba(79,70,229,var(--tw-text-opacity))}.tracking-tight{letter-spacing:-0.025em}.w-full{width:100%}@media(min-width:640px){.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:mx-auto{margin-left:auto;margin-right:auto}.sm\:mt-5{margin-top:1.25rem}}@media(min-width:768px){.md\:text-xl{font-size:1.25rem;line-height:1.75rem}.md\:mx-0{margin-left:0;margin-right:0}.md\:mt-5{margin-top:1.25rem}}@media(min-width:1024px){.lg\:flex-shrink-0{flex-shrink:0}.lg\:mx-0{margin-left:0;margin-right:0}.lg\:mt-5{margin-top:1.25rem}.lg\:w-2\/3{width:66.666667%}}@media(min-width:1280px){.xl\:inline{display:inline}}</style>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/codemirror@5/lib/codemirror.min.css" />
<link rel="stylesheet" href="dist/theme.min.css" />
</head>
<body class="flex flex-col bg-grey-lighter dark:bg-gray-800 h-screen p-4 font-sans">
<main class="container mx-auto flex justify-center">
<div class="mx-5 w-full lg:w-2/3 md:mx-0">
<h1 class="text-2xl tracking-tight text-gray-900">
<span class="block xl:inline">@visbot/codemirror-avs</span>
</h1>
<p class="mt-3 text-base text-gray-500 sm:mt-5 sm:text-lg sm:mx-auto md:mt-5 md:text-xl lg:mx-0">
A mode for <a class="text-indigo-600" href="https://www.wikiwand.com/en/Advanced_Visualization_Studio">Winamp AVS</a> to use with
<a class="text-indigo-600" href="https://codemirror.net/">CodeMirror</a>, the versatile text editor implemented in JavaScript for the browser.
</p>
<div class="mt-8 lex lg:mt-5 lg:flex-shrink-0">
<p class="mt-3">
<label class="font-semibold" for="frame">Frame</label>
<textarea id="frame" class="codemirror">
nn=if(below(w,500),4,if(below(w,1000),6,8));
n=ceil((w/nn))*2+4;
m=1/(n-1);
linesize=nn-1;
yms=if(equal(ymt,dest),0,ymu);
ymt=if(above(abs(ymt),4),-4*sign(ymt),ymt+yms);
//first time only
wh=(ww-w);
ww=w;
p=1;
loop(if(wh,n/2,0),exec3(
assign(p,p+2),
assign(megabuf(p+1000),rand(35)*.01+.65),
assign(megabuf(p+2000),(rand(20)-10)*.005)));
p=1;
loop(if(wh,n/2,0),exec3(
assign(p,p+2),
assign(megabuf(p+3000),rand(10)*.02),
assign(megabuf(p+4000),rand(628)*.01)));
p=1;
loop(if(wh,n/2,0),exec3(
assign(p,p+2),
assign(megabuf(p+7000),rand(35)*.01+.65),
assign(megabuf(p+8000),(rand(20)-10)*.005)));
p=1;
loop(if(wh,n/2,0),exec3(
assign(p,p+2),
assign(megabuf(p+9000),rand(10)*.02),
assign(megabuf(p+10000),rand(628)*.01)));
p=1;
loop(if(wh,n/2,0),exec3(
assign(p,p+2),
assign(megabuf(p+13000),rand(80)*.01),
assign(megabuf(p+14000),(rand(20)-10)*.005)));
p=1;
loop(if(wh,n/2,0),exec3(
assign(p,p+2),
assign(megabuf(p+15000),rand(10)*.02),
assign(megabuf(p+16000),rand(628)*.01)));
//original t value & rand getspec value
p=1;
loop(if(wh,n/2,0),exec3(
assign(p,p+2),
assign(megabuf(p+23000),rand(1000)),
assign(megabuf(p+30000),rand(80)*.01)));
//red
p=1;
loop(n/2,exec3(
assign(p,p+2),
assign(megabuf(p+5000),
megabuf(p+5000)+megabuf(p+2000)),
assign(megabuf(p+6000),
megabuf(p+1000)+sin(megabuf(p+5000)
+megabuf(p+4000))*megabuf(p+3000))));
//green
p=1;
loop(n/2,exec3(
assign(p,p+2),
assign(megabuf(p+11000),
megabuf(p+11000)+megabuf(p+8000)),
assign(megabuf(p+12000),
megabuf(p+7000)+sin(megabuf(p+11000)
+megabuf(p+10000))*megabuf(p+9000))));
//blue
p=1;
loop(n/2,exec3(
assign(p,p+2),
assign(megabuf(p+17000),
megabuf(p+17000)+megabuf(p+14000)),
assign(megabuf(p+18000),
megabuf(p+13000)+sin(megabuf(p+17000)
+megabuf(p+16000))*megabuf(p+15000))));
//vertical movement
p=1;
loop(n/2,exec3(
assign(p,p+2),
assign(megabuf(p+22000),
megabuf(p+22000)*megabuf(p+21000)),
assign(megabuf(p+23000),
megabuf(p+23000)+megabuf(p+22000)+getspec(megabuf(p+30000),.1,0)*.15)));
p=1;
loop(n/2,exec2(
assign(p,p+2),
assign(megabuf(p+20000),
sin(megabuf(p+23000))*cos(megabuf(p+23000)*.7))));</textarea
>
</p>
<p class="mt-3">
<label class="font-semibold" for="beat">Beat</label>
<textarea id="beat" class="codemirror">
uu=equal(ymt,dest)*floor(rand(18)/17);
rb=rand(5)-3;
ru=if(uu,ru+rb,ru);
ymu=if(uu,.02*sign(rb),ymu);
rru=abs(ru%6);
dest=if(uu,(rru*.5)+1.25*sign(rru-2.5)-1.25,dest);
p=1;
loop(n/2,exec3(
assign(p,p+2),
assign(megabuf(p+21000),(rand(15)+85)*.01),
assign(megabuf(p+22000),(rand(20)-10)*.01)));</textarea
>
</p>
<p class="mt-3">
<label class="font-semibold" for="point">Point</label>
<textarea id="point" class="codemirror">
k=-k;
x=(i*2-1+m*-k)*(1+m*3);
yt=megabuf(i*n+20000)+megabuf(i*n+20001);
y=k*2+yt+ymt;
red=megabuf(i*n+6000);
green=megabuf(i*n+12000);
blue=megabuf(i*n+18000);
drawmode=k;</textarea
>
</p>
</div>
</div>
</main>
<footer class="w-full text-center p-4 pin-b">
<a href="https://github.com/visbot/codemirror-avs" class="text-indigo-600">Code on GitHub</a>
</footer>
<script defer src="https://cdn.jsdelivr.net/npm/codemirror@5/lib/codemirror.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/codemirror@5/addon/edit/matchbrackets.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/addon/edit/closebrackets.min.js"></script>
<script defer src="dist/avs.min.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function () {
const editors = document.getElementsByClassName("codemirror");
const options = {
autoCloseBrackets: true,
lineNumbers: true,
matchBrackets: true,
mode: "avs/ssc",
smartIndent: false,
theme: "bootstrap",
};
Object.keys(editors).map(function (i) {
const cm = CodeMirror.fromTextArea(editors[i], options);
});
});
</script>
</body>
</html>