annotate www/mockup/effectpreview.html @ 1010:45290696a438

add new html mockups Ignore-this: 6f4c1701a5a9f378217d513ee88368a0
author drewp@bigasterisk.com
date Sat, 26 Apr 2014 17:48:21 +0000
parents
children bdbf9f3acc6b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1010
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
1 <!doctype html>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
2 <html>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
3 <head>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
4 <title></title>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
5 <meta charset="utf-8" />
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
6 <style>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
7 body {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
8 font-family: sans;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
9 font-size: 8px;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
10 background: black;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
11 color: gray;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
12 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
13 a {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
14 color: #aff;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
15 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
16 canvas {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
17 outline: 1px solid gray;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
18 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
19 svg {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
20 pointer-events: none;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
21 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
22 .markers text {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
23 fill: white;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
24 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
25 .timelineArea {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
26 display: inline-block;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
27 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
28 .codeLine {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
29 margin-bottom: 3em;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
30 position: relative;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
31 border: 1px solid #dfdfdf;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
32 padding: 5px;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
33 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
34 .codeLine canvas {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
35 display: block;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
36 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
37 code {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
38 display: block;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
39 font-size: 14px;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
40 margin: 20px 0;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
41 padding: 5px;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
42 color: white;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
43 background: rgba(34, 34 34, 0.52);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
44 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
45 .alignStartTime {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
46 margin-left: 150px;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
47 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
48 .codeLine .inputs, .codeLine .output {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
49 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
50 .codeLine .inputs {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
51 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
52 .codeLine .output {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
53 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
54 .codeLine svg.arrows {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
55 position: absolute;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
56 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
57 .timelineArea {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
58 position: relative;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
59 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
60 svg.markers {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
61 position: absolute;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
62 top: 0;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
63 left: 150px;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
64 right: 0;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
65 bottom: 0;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
66 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
67 .adjustable {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
68 border: 2px dashed rgb(72, 72, 252);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
69 padding: 0 4px;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
70 background: rgba(109, 109, 253, 0.38);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
71 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
72 .markers path {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
73 stroke:#ffffff;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
74 stroke-width:1;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
75 opacity:0.31660232
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
76 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
77 </style>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
78 </head>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
79 <body>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
80 <h1>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
81 Effect chase1
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
82 </h1>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
83 <div>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
84 (&lt;--&gt; timeline adjusters)
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
85 </div>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
86 <div class="timelineArea">
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
87 <!-- times + beats + now, extends under the rest -->
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
88 <svg class="markers">
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
89 <text x="0" y="10"> 0sec </text><path d="m0,20 0,2000"></path>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
90 <text x="80" y="10"> 10 </text><path d="m30,20 0,2000"></path>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
91 <text x="160" y="10"> 20 </text><path d="m60,20 0,2000"></path>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
92 <text x="240" y="10"> 30 </text><path d="m90,20 0,2000"></path>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
93 <text x="320" y="10"> 40 </text><path d="m120,20 0,2000"></path>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
94 </svg>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
95
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
96 <div class="codeLine">
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
97 <style>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
98 .arrows path {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
99 fill:none;stroke:#ffffff;stroke-width:2.10000000000000009;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none;marker-end:url(#Arrow2Mend);opacity:0.31660232
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
100 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
101 </style>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
102 <svg class="arrows">
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
103 <defs id="defs4">
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
104 <marker orient="auto" refY="0.0" refX="0.0" id="Arrow2Mend" style="overflow:visible;">
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
105 <path style="fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
106 d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
107 transform="scale(0.6) rotate(180) translate(0,0)" />
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
108 </marker>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
109 </defs>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
110 <path class="arrow" d="m0,0"></path>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
111 </svg>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
112 <div class="inputs">
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
113 </div>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
114 <code><span class="out" id="out1var">hue</span> = nsin(t * <span class="adjustable" data-param="sinTimeCoeff">.5</span> + 2pi * <span class="adjustable" data-param="sinTimeOffset">0</span>)</code>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
115 <div class="alignStartTime">
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
116 <canvas class="output" id="out1"></canvas>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
117 </div>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
118 </div>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
119
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
120 <div class="codeLine">
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
121 <svg class="arrows"> <defs></defs>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
122 <path class="arrow" d="m0,0"></path>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
123 <path class="arrow" d="m0,0"></path>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
124 <path class="arrow" d="m0,0"></path>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
125 </svg>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
126 <div class="inputs">
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
127 <div class="alignStartTime">
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
128 <canvas class="input" id="in1"></canvas>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
129 </div>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
130 <div class="alignStartTime">
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
131 <canvas class="input" id="in2"></canvas>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
132 </div>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
133 </div>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
134 <code><span id="out2var">val</span> = <span id="in21var">backchase</span> * (<span id="in22var">music</span> &gt; <span class="adjustable" data-param="valThresh">.3</span>)</code>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
135 <div class="alignStartTime">
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
136 <canvas class="output" id="out2"></canvas>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
137 </div>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
138 </div>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
139
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
140 <div class="codeLine">
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
141 <svg class="arrows"> <defs></defs><path class="arrow" d="m0,0"></path> </svg>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
142 <div class="inputs">
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
143 </div>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
144 <code><span id="out3var">out</span> = hsv2rgb(hue, <span class="adjustable" data-param="sat">1.0</span>, val)</code>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
145 <div class="alignStartTime">
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
146 <canvas class="output" id="out3"></canvas>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
147 </div>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
148 </div>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
149 </div>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
150 <style>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
151 .dragValue {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
152 position: absolute;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
153 left: 98px;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
154 top: 168px;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
155 width: 300px;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
156 background: rgba(80,80,80,0.64);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
157 color: white;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
158 border: 1px solid black;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
159 box-shadow: 5px 5px 73px black;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
160 font-size: 26px;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
161 -webkit-user-select: none;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
162
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
163 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
164 .dragValue table {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
165 width: 100%;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
166 border-collapse: collapse;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
167 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
168 .dragValue table tr.current td {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
169 background: rgba(128, 128, 128, 0.71);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
170 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
171 .dragValue table td {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
172 border-left: 1px solid black;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
173 height: 80px;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
174 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
175 .dragValue table .low { }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
176 .dragValue table .high { text-align: right; }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
177
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
178 div.newValue {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
179 position: absolute;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
180 display: inline-block;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
181 border: 1px solid black;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
182 border-radius: 50%;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
183 padding: 3px;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
184 font-size: 20px;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
185 color: black;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
186 background: rgb(241, 241, 144);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
187 box-shadow: 3px 4px 12px rgba(0, 0, 0, 0.23);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
188 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
189 </style>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
190 <div class="dragValue">
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
191 Editing .5 to <span class="newValue">.5</span>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
192 <table>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
193 <tr data-bounds="0 1"><td class="low">0 ||||||||||</td><td class="high">|||||||||| 1</td></tr>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
194 <tr data-bounds=".4 .6"><td class="low">.4 | | | | |</td><td class="high">| | | | | .6</td></tr>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
195 <tr data-bounds=".49 .51"><td class="low">.49</td><td class="high">.51</td></tr>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
196 </table>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
197 <div class="newValue">.5</div>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
198 </div>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
199
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
200 <script src="/lib/jquery-2.0.3.min.js"></script>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
201 <script src="/lib/rickshaw/71877d994a/vendor/d3.min.js"></script>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
202 <script type="text/javascript">
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
203 window.onload = function () {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
204
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
205 var _music = [];
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
206 for (var x=0; x<1000; x++) {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
207 _music.push(Math.random());
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
208 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
209 function musicCurve(x) {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
210 return _music[Math.round(x)];
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
211 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
212 var params = {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
213 sinTimeCoeff: .1,
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
214 sinTimeOffset: 0,
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
215 valThresh: .5,
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
216 sat: 1
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
217 };
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
218
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
219 function hue(x) { return Math.sin(x * params.sinTimeCoeff + 6.28 * params.sinTimeOffset) * .5 + .5; }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
220 function valFunc(x) { return (x > 100 && x < 300) * (musicCurve(x) > params.valThresh); }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
221
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
222 function drawCurve(canvas, func) {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
223 var ctx = canvas.getContext('2d');
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
224 ctx.clearRect(0, 0, canvas.width, canvas.height);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
225
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
226 ctx.strokeStyle = '#ffffff';
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
227 ctx.fillStyle = '#666';
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
228 ctx.strokeWidth = 3;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
229 ctx.beginPath();
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
230 ctx.moveTo(0, canvas.height);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
231 for (var x = 0; x < canvas.width; x += 2) {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
232 var y = func(x);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
233 ctx.lineTo(x, canvas.height * (1 - y));
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
234 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
235 ctx.lineTo(canvas.width, canvas.height);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
236 ctx.fill();
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
237 ctx.stroke();
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
238 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
239 function drawRgb(canvas) {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
240 var ctx = canvas.getContext('2d');
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
241 ctx.clearRect(0, 0, canvas.width, canvas.height);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
242 var step = 1;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
243 for (var x = 0; x < canvas.width; x+= step) {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
244 var vv = (valFunc(x) * .5 * 100);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
245 ctx.fillStyle = ('hsl('+
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
246 (360 * hue(x))+','+
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
247 (params.sat * 100)+'%,'+
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
248 vv+'%'+
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
249 ')');
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
250 if (vv > 0) {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
251 ctx.fillRect(x, 0, step, canvas.height);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
252 } // else leave it transparent
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
253 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
254 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
255
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
256 function drawTimeCoords(svg) {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
257 // use KO on svg templates
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
258 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
259 function routePath(svg, src, dest) {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
260 var parent = $(svg).position();
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
261 var srcPos = src.position();
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
262 var destPos = dest.position();
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
263 var startDown = srcPos.left < 150;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
264 if (startDown) {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
265 srcPos.left += src.width() / 2;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
266 srcPos.top += src.height();
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
267 destPos.top += dest.height() / 2;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
268 } else {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
269 srcPos.top += src.height() / 2;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
270 destPos.left += dest.width() / 2;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
271 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
272
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
273 var d = "";
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
274 var px = parent.left, py = parent.top;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
275 d += "m" + (srcPos.left - px) + "," + (srcPos.top - py);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
276 if (startDown) {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
277 d += "L" + (srcPos.left - px) + "," + (destPos.top - py);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
278 } else {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
279 if (destPos.left < srcPos.left) {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
280 d += "L" + (destPos.left - px) + "," + (srcPos.top - py);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
281 } else {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
282 d += "L" + (srcPos.left - px - 10) + "," + (srcPos.top - py);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
283 var ymid = srcPos.top + src.height() / 2 + 5;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
284 d += "L" + (srcPos.left - px - 10) + "," + (ymid - py);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
285 d += "L" + (destPos.left - px) + "," + (ymid - py);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
286 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
287 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
288 d += "L" + (destPos.left - px) + "," + (destPos.top - py);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
289 return d;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
290 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
291 function connectElems(svg, src, dest) {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
292 // this is wrong; it's not a proper path object
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
293 var path = document.createElementNS('svg', 'path');
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
294 svg.appendChild(path);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
295
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
296 // workaround- use spare path nodes
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
297 for (var i = 1; i < svg.children.length; i++) {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
298 path = svg.children[i];
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
299 if (path.getAttribute('d') == 'm0,0') {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
300 break;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
301 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
302 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
303
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
304 path.classList.add('arrow');
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
305 path.setAttribute('d', routePath(svg, src, dest));
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
306 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
307
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
308 function connectVars() {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
309 connectElems($("#out1").closest(".codeLine").find(".arrows")[0], $("#out1var"), $("#out1"));
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
310 connectElems($("#out2").closest(".codeLine").find(".arrows")[0], $("#out2var"), $("#out2"));
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
311 connectElems($("#out3").closest(".codeLine").find(".arrows")[0], $("#out3var"), $("#out3"));
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
312
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
313 connectElems($("#out2").closest(".codeLine").find(".arrows")[0], $("#in1"), $("#in21var"));
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
314 connectElems($("#out2").closest(".codeLine").find(".arrows")[0], $("#in2"), $("#in22var"));
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
315 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
316 function redrawAll() {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
317 $("canvas").each(function (i, canvas) {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
318 canvas.width = 500;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
319 canvas.height = 30;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
320 });
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
321 drawCurve($("#out1")[0], hue)
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
322 drawCurve($("#in1")[0], function (x) { return x > 100 && x < 300; })
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
323 drawCurve($("#in2")[0], function (x) { return musicCurve(x); })
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
324 drawCurve($("#out2")[0], valFunc);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
325 drawRgb($("#out3")[0]);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
326
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
327 $("svg.arrows").each(function (i, svg) {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
328
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
329 });
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
330 drawTimeCoords($(".markers"));
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
331 connectVars();
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
332 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
333 redrawAll();
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
334
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
335
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
336 var adjusting = null;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
337 var adjustParam = "";
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
338 $(".dragValue").hide();
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
339 $(".adjustable").mousedown(function (ev) {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
340 $(".dragValue").show();
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
341 adjusting = $(ev.target);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
342 adjustParam = adjusting.attr('data-param');
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
343 $(".dragValue").css({left: adjusting.offset().left - 150,
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
344 top: adjusting.offset().top - 120});
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
345 });
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
346 $("body, .dragValue").mouseup(function (ev) {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
347 $(".dragValue").hide();
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
348 });
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
349 $(".dragValue").mousemove(function (ev) {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
350 var dv = $(".dragValue").position();
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
351 $(".dragValue div.newValue").css({left: ev.pageX - dv.left - 15, top: ev.pageY - dv.top - 35});
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
352 var row = $(ev.target).closest('tr');
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
353 $(".dragValue tr").removeClass('current');
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
354 if (!row.length) {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
355 // revert
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
356 return;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
357 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
358 row.addClass('current');
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
359
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
360 var rx = row.offset().left;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
361 var frac = (ev.pageX - rx) / row.width();
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
362
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
363 var bounds = row.attr('data-bounds').split(" ");
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
364 var newValue = parseFloat(bounds[0]) * (1 - frac) + parseFloat(bounds[1]) * frac;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
365 newValue = Math.round(newValue * 1000) / 1000;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
366 valueChanged(newValue);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
367 });
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
368 function valueChanged(newValue) {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
369 if (adjusting) {
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
370 adjusting.text(newValue);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
371 }
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
372 $(".dragValue .newValue").text(newValue);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
373 params[adjustParam] = newValue;
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
374 drawCurve($("#out1")[0], hue)
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
375 drawCurve($("#out2")[0], valFunc);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
376 drawRgb($("#out3")[0]);
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
377 };
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
378
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
379 };
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
380 </script>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
381 </body>
45290696a438 add new html mockups
drewp@bigasterisk.com
parents:
diff changeset
382 </html>