annotate awesome_js/robert.js @ 43:329638a361cc laserkard

[svn r44] implemented redraw memory.
author rlm
date Thu, 28 Jan 2010 00:32:54 -0500
parents ef8615de8a9c
children 1045db9799e3
rev   line source
rlm@29 1
rlm@29 2
rlm@29 3
rlm@42 4 function defaults()
rlm@42 5 {
rlm@42 6 alias = "Robert Mac";
rlm@42 7 email = "rlm@mit.edu";
rlm@42 8 occupation = "";
rlm@42 9 company = "";
rlm@42 10 phone = "";
rlm@42 11 website = "";
rlm@42 12 lineArt = "";
rlm@42 13 }
rlm@29 14
rlm@29 15
rlm@42 16 function drawElement(obj)
rlm@42 17 {
rlm@42 18
rlm@42 19 }
rlm@42 20
rlm@42 21 function redraw(style)
rlm@42 22 {
rlm@42 23
rlm@43 24
rlm@43 25 var JSONtext = document.getElementById('formValues').innerHTML;
rlm@43 26 var hash = new Object();
rlm@43 27 hash = eval('(' + JSONtext + ')');
rlm@43 28
rlm@43 29 if(hash.Name){alias = hash.Name;}
rlm@43 30 if(hash.Email){email = hash.Email;}
rlm@43 31 if(hash.Occupation){occupation = hash.Occupation;}
rlm@43 32 if(hash.Company){company = hash.Company;}
rlm@43 33 if(hash.Phone){phone = hash.Phone;}
rlm@43 34 if(hash.website){website = Website;}
rlm@43 35
rlm@42 36 if (style == "bold")
rlm@42 37 {
rlm@42 38
rlm@42 39
rlm@42 40
rlm@42 41 if(typeof d_alias != 'undefined' ){d_alias.remove();}
rlm@42 42 if(typeof d_email != 'undefined' ){d_email.remove();}
rlm@42 43 if(typeof d_occupation != 'undefined' ){d_occupation.remove();}
rlm@42 44 if(typeof d_company != 'undefined' ){d_company.remove();}
rlm@42 45 if(typeof d_phone != 'undefined' ){d_phone.remove();}
rlm@42 46 if(typeof d_website != 'undefined' ){d_website.remove();}
rlm@42 47 if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();}
rlm@42 48
rlm@42 49
rlm@42 50
rlm@43 51
rlm@43 52 d_alias = raphe.print(10, 160, alias, raphe.getFont('HelveticaNeue', 700), 60);
rlm@42 53 d_alias.attr('stroke', '#6a6a6a');
rlm@42 54 d_alias.attr('fill', 'none')
rlm@42 55 var c = d_alias.getBBox().width;
rlm@42 56 d_alias.translate((485 - c)/2,0);
rlm@42 57
rlm@42 58
rlm@42 59
rlm@43 60
rlm@43 61 d_email = raphe.print(280, 270, email, raphe.getFont("HelveticaNeue", 700), 25);
rlm@42 62 d_email.attr('stroke', '#6a6a6a');
rlm@42 63 d_email.attr('fill', 'TRANSPARENT');
rlm@42 64
rlm@42 65
rlm@42 66
rlm@42 67
rlm@42 68 }
rlm@42 69
rlm@42 70
rlm@42 71 if (style == "arrow")
rlm@42 72 {
rlm@42 73
rlm@42 74 if(typeof d_alias != 'undefined' ){d_alias.remove();}
rlm@42 75 if(typeof d_email != 'undefined' ){d_email.remove();}
rlm@42 76 if(typeof d_occupation != 'undefined' ){d_occupation.remove();}
rlm@42 77 if(typeof d_company != 'undefined' ){d_company.remove();}
rlm@42 78 if(typeof d_phone != 'undefined' ){d_phone.remove();}
rlm@42 79 if(typeof d_website != 'undefined' ){d_website.remove();}
rlm@42 80 if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();}
rlm@42 81
rlm@42 82
rlm@43 83
rlm@43 84 d_alias = raphe.print(40, 110, alias, raphe.getFont('HelveticaNeue', 700), 55);
rlm@42 85 d_alias.attr('stroke', '#6a6a6a');
rlm@42 86 d_alias.attr('fill', 'none')
rlm@42 87
rlm@43 88 d_company = raphe.print(40, 155, company, raphe.getFont("HelveticaNeue", 700), 27);
rlm@42 89 d_company.attr('stroke', '#6a6a6a');
rlm@42 90 d_company.attr('fill', 'TRANSPARENT');
rlm@42 91
rlm@43 92 d_occupation = raphe.print(40, 190, occupation, raphe.getFont("HelveticaNeue", 700), 27);
rlm@42 93 d_occupation.attr('stroke', '#6a6a6a');
rlm@42 94 d_occupation.attr('fill', 'TRANSPARENT');
rlm@42 95
rlm@43 96 d_email = raphe.print(280, 270, email, raphe.getFont("HelveticaNeue", 700), 25);
rlm@42 97 d_email.attr('stroke', '#6a6a6a');
rlm@42 98 d_email.attr('fill', 'TRANSPARENT');
rlm@42 99
rlm@42 100 d_lineArt = raphe.path("M 2 272 L 258 272");
rlm@42 101 d_lineArt.attr('stroke', '#6a6a6a');
rlm@42 102
rlm@42 103 }
rlm@42 104
rlm@42 105
rlm@42 106 if (style == "classic")
rlm@42 107 {
rlm@42 108
rlm@42 109 if(typeof d_alias != 'undefined' ){d_alias.remove();}
rlm@42 110 if(typeof d_email != 'undefined' ){d_email.remove();}
rlm@42 111 if(typeof d_occupation != 'undefined' ){d_occupation.remove();}
rlm@42 112 if(typeof d_company != 'undefined' ){d_company.remove();}
rlm@42 113 if(typeof d_phone != 'undefined' ){d_phone.remove();}
rlm@42 114 if(typeof d_website != 'undefined' ){d_website.remove();}
rlm@42 115 if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();}
rlm@42 116
rlm@42 117
rlm@43 118 d_email = raphe.print(0, 42, email, raphe.getFont("HelveticaNeue", 700), 29);
rlm@42 119 d_email.attr('stroke', '#6a6a6a');
rlm@42 120 d_email.attr('fill', 'TRANSPARENT');
rlm@42 121 var c = d_email.getBBox().width;
rlm@42 122 d_email.translate((510 - c)/2,0);
rlm@42 123
rlm@42 124
rlm@42 125
rlm@43 126 d_phone = raphe.print(0, 75, phone, raphe.getFont("HelveticaNeue", 700), 27);
rlm@42 127 d_phone.attr('stroke', '#6a6a6a');
rlm@42 128 d_phone.attr('fill', 'TRANSPARENT');
rlm@42 129 var c = d_phone.getBBox().width;
rlm@42 130 d_phone.translate((510 - c)/2,0);
rlm@42 131
rlm@42 132
rlm@43 133 d_alias = raphe.print(0, 164, alias, raphe.getFont('HelveticaNeue', 800), 47);
rlm@42 134 d_alias.attr('stroke', '#6a6a6a');
rlm@42 135 d_alias.attr('fill', 'none')
rlm@42 136 var c = d_alias.getBBox().width;
rlm@42 137 d_alias.translate((510 - c)/2,0);
rlm@42 138
rlm@42 139
rlm@43 140 d_company = raphe.print(0, 247, company, raphe.getFont("HelveticaNeue", 700), 27);
rlm@42 141 d_company.attr('stroke', '#6a6a6a');
rlm@42 142 d_company.attr('fill', 'TRANSPARENT');
rlm@42 143 var c = d_company.getBBox().width;
rlm@42 144 d_company.translate((510 - c)/2,0);
rlm@42 145
rlm@42 146
rlm@42 147
rlm@43 148 d_occupation = raphe.print(0, 278, occupation, raphe.getFont("HelveticaNeue", 700), 27);
rlm@42 149 d_occupation.attr('stroke', '#6a6a6a');
rlm@42 150 d_occupation.attr('fill', 'TRANSPARENT');
rlm@42 151 var c = d_occupation.getBBox().width;
rlm@42 152 d_occupation.translate((510 - c)/2,0);
rlm@42 153
rlm@42 154
rlm@43 155 d_website = raphe.print(0, 0, website, raphe.getFont("HelveticaNeue", 700), 21);
rlm@42 156 d_website.attr('stroke', '#6a6a6a');
rlm@42 157 d_website.attr('fill', 'TRANSPARENT');
rlm@42 158
rlm@42 159 var c = d_website.getBBox().width;
rlm@42 160 d_website.translate((317 - c)/2,0);
rlm@42 161
rlm@42 162 d_website.translate(0, -490);
rlm@42 163 d_website.rotate(90,0,0);
rlm@42 164 }
rlm@42 165
rlm@42 166
rlm@42 167 if (style == "direct")
rlm@42 168 {
rlm@42 169
rlm@42 170 if(typeof d_alias != 'undefined' ){d_alias.remove();}
rlm@42 171 if(typeof d_email != 'undefined' ){d_email.remove();}
rlm@42 172 if(typeof d_occupation != 'undefined' ){d_occupation.remove();}
rlm@42 173 if(typeof d_company != 'undefined' ){d_company.remove();}
rlm@42 174 if(typeof d_phone != 'undefined' ){d_phone.remove();}
rlm@42 175 if(typeof d_website != 'undefined' ){d_website.remove();}
rlm@42 176 if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();}
rlm@42 177
rlm@42 178
rlm@42 179
rlm@43 180
rlm@43 181 d_alias = raphe.print(37, 70, alias, raphe.getFont('HelveticaNeue', 700), 55);
rlm@42 182 d_alias.attr('stroke', '#6a6a6a');
rlm@42 183 d_alias.attr('fill', 'none')
rlm@42 184
rlm@42 185
rlm@43 186
rlm@43 187 d_occupation = raphe.print(37, 120, occupation, raphe.getFont("HelveticaNeue", 700), 27);
rlm@42 188 d_occupation.attr('stroke', '#6a6a6a');
rlm@42 189 d_occupation.attr('fill', 'TRANSPARENT');
rlm@42 190
rlm@42 191
rlm@43 192
rlm@43 193 d_company = raphe.print(37, 178, company, raphe.getFont("HelveticaNeue", 700), 27);
rlm@42 194 d_company.attr('stroke', '#6a6a6a');
rlm@42 195 d_company.attr('fill', 'TRANSPARENT');
rlm@42 196
rlm@42 197
rlm@42 198
rlm@43 199 d_phone = raphe.print(37, 210, phone, raphe.getFont("HelveticaNeue", 700), 27);
rlm@42 200 d_phone.attr('stroke', '#6a6a6a');
rlm@42 201 d_phone.attr('fill', 'TRANSPARENT');
rlm@42 202
rlm@42 203
rlm@43 204
rlm@43 205 d_email = raphe.print(37, 240, email, raphe.getFont("HelveticaNeue", 700), 27);
rlm@42 206 d_email.attr('stroke', '#6a6a6a');
rlm@42 207 d_email.attr('fill', 'TRANSPARENT');
rlm@42 208
rlm@42 209
rlm@43 210
rlm@43 211
rlm@43 212 d_website = raphe.print(37, 270, website, raphe.getFont("HelveticaNeue", 700), 27);
rlm@42 213 d_website.attr('stroke', '#6a6a6a');
rlm@42 214 d_website.attr('fill', 'TRANSPARENT');
rlm@42 215
rlm@42 216 d_lineArt = raphe.path("M 350 165 L 512 165 M 350 173 L 512 173 M 350 181 L 512 181 M 350 189 L 512 189 M 350 197 L 512 197 M 350 213 L 512 213 M 350 205 L 512 205 M 350 221 L 512 221");
rlm@42 217 d_lineArt.attr('stroke', '#6a6a6a');
rlm@42 218
rlm@42 219
rlm@42 220
rlm@42 221 }
rlm@42 222
rlm@42 223
rlm@42 224
rlm@42 225
rlm@42 226
rlm@42 227 }
rlm@42 228
rlm@42 229