File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,13 +59,19 @@ <h1>box-shadow spread rounding</h1>
5959
6060 < label >
6161 Algorithm:
62- < select id ="algorithm " size ="4 ">
62+ < select id ="algorithm " size ="6 ">
6363 < option value ="old "> Old</ option >
6464 < option value ="arc "> Arc</ option >
6565 < option value ="hyp "> Hyperbolic</ option >
6666 < option value ="cubic " selected > Cubic</ option >
67+ < option value ="linear "> Linear</ option >
68+ < option value ="custom "> Custom</ option >
6769 </ select >
6870 </ label >
71+
72+ < label > f(x) =
73+ < input id ="custom " value ="x < 1? 1-(x-1)*(x-1) : 1 " />
74+ </ label >
6975</ form >
7076
7177< div class ="box ">
@@ -134,6 +140,19 @@ <h1>box-shadow spread rounding</h1>
134140
135141 cubic : function ( x ) {
136142 return x < 1 ? 1 + Math . pow ( x - 1 , 3 ) : 1 ;
143+ } ,
144+
145+ linear : function ( x ) {
146+ return x < 1 ? x : 1 ;
147+ } ,
148+
149+ custom : function ( x ) {
150+ try {
151+ return eval ( custom . value ) ;
152+ } catch ( e ) {
153+ console . log ( e ) ;
154+ return 0 ;
155+ }
137156 }
138157} ;
139158
@@ -172,11 +191,15 @@ <h1>box-shadow spread rounding</h1>
172191algorithm . onchange = function ( ) {
173192 Box . ratio = Box . ratios [ this . value ] ;
174193
194+ custom . parentNode . style . visibility = this . value == 'custom' ? '' : 'hidden' ;
195+
175196 Box . redrawAll ( ) ;
176197} ;
177198
178199algorithm . onchange ( ) ;
179200
201+ custom . oninput = Box . redrawAll ;
202+
180203//constant.oninput = function() {
181204// Box.constant = +this.value;
182205//
You can’t perform that action at this time.
0 commit comments