/*! Purpose: * * Scroll content in parameter "text" from right to left in peculiar Martinland fashion... * * History: * * 02/20/2021: Release * 02/19/2021: Fine-tuning... * 02/18/2021: Complete reimplementation in JavaScript: Java is borked now (20 years after the fact! ;-) * 02/17/2021: Version 3.0 * * Now historical, original commentaries: * * 07/21/2010: removed deprecated (after 10 years!) code! 8-D * 07/21/2010: put jitter back in... * 07/21/2010: added double buffering because of annoying flicker on modern systems (10 years after! ;-) * 07/21/2010: Version 2.0 * * 11/11/2000: changed colorization * 11/09/2000: added vector characters * 11/06/2000: improved redraw; added comments; tightened code * 11/05/2000: Version 1.0 */ // Screen canvas and context var sC = document.getElementById('mlCanvas'); if (sC) { // Is there an element at all? var sCC = sC.getContext('2d'); if (sCC) { // Is there HTML5 support at all? // Double buffer canvas and context var sB = document.createElement('canvas'); sB.width=sC.width; sB.height=sC.height; var sBC = sB.getContext('2d'); // Click function for playing Martinland signation... var mlSound = document.getElementById("mlSig"); function letsHearIt() { mlSound.play(); } var sScale = sC.height / 6; // Global scaling var sText = "latest update may/01/2024: new joyful c64/theremin events arrived in thereminland - latest c64 tune is now part of the composer section - igor returns for all, thanks to ruffle - re-implementation of this routine 20 years after its creation, again at 3:00 am, see very end of this loong scroll text if you dare - martinland sings again for favourable browsers - three additional theremin events - five more synthesizer pieces resurrected into the media section below - cd release party vibes online, one year after the fact - one of my earliest compositions made it into the media section - adventure game _heroes_and_cowards_ finally out there - hurray, audio cd _thereminland_ has arrived: see media section below - more c-64 chiptunes and literature - welcome sam and max a la martinland - 3d-animated web experience _acousmonuments_ has been launched - found drawing, 24 years old - animation short _intersphere_ online now - thx-like intro animation plus ancient thx trailer test online now - after decades i finally completed my first german short story - found crazy old tape: in media section now - 3d animation intinahui released in theaters and on dvd, see movie palace at the right-hand side - mr.pixelpop cd cover art now in cartoon vault - dancing egg-shells are here - theremin updates - bio updates - about martinland flip books - more time-lapse retro scoring - retro computing sketches - mediabot is on the run - added five new lobert episodes - theremin updates - two ancient synthesizer pieces in the media section - sambucus nigra plant portraits - premiere of lomi rotoscope animation - retro poem audification in media section - new lobert comic strips in the vault - video game examples online now - an example of time-lapse retro scoring - a web page far, far away has been added - now featuring cropfm, the flexxxible radioshow - added _sailing island_ - cartoon-animated website abrahama sama clara - flip book w sound - about martinland - added _nachlage_ - first cartoon-animated website now hosted by trusty igor in the vault... - finally: after one year of preparations thereminland opens its gates in the media section - belated inclusion of vis-page - bio-page revamped - added new lobert strips plus _making of_ and 24 hour comic 2005 - welcome maxie, the girl of the future and tle-films - lobert now resides in cartoon vault - new blade runner music and borderline art in the media section - der kineast number 4 hits the cartoon vault - encounter with gonzo added to bio page - my second _24 hour comic_ hits the world - welcome the first _24 hour comic_ in the vault - found an old cartoon in a keyboard manual - celly now resides in the media section - der kineast 3 now in the vault - added original 8bit retro c64 musix - revamped bio page - the media-section now features the stop motion version of _auslage_ - _der kineast_ has been handed over to good ole igor in the cartoon vault - i have completed _mike special edition_ with over-the-top sound - jurassic loop special edition has arrived - let there be light special edition is online - _life on the edge_ has its premiere in the movie palace - added complete version of _18 months later_ to movie palace - welcome igor, who is taking care of the cartoon vault behind that door - electronic music for ars electronica festival - borderline art, both down in the media section - please welcome mike - i dug up more nostalgic instrumentals - _18 months later_, the first martinland film production is presented in the movie palace at the right-hand side - kali stars in _jurassic loop_ - _lara_ joined the team - vismax has entered the game - martinland, the radioshow, is on the air - added signation with flash and a smile towards john williams, plus more mp3z - find out what a yoobaa-sketch is... - _genie_ is taking flight in the media section - finally: the short _the frog that croaked too much_ gets online - big newsflash: _patrick_ has arrived - this java scroll is a monday 3:00 am job, by the way..."; var sWrap = -sScale * sText.length*2.85; // X position after which scroll should wrap var sX = sC.width + sScale*10; // Current x position of scrolltext var sY = sScale*2; // Current y position of scrolltext var sCX = 0; // Current character x position var sCY = 0; // Current character y position var sJF1, sJF2, sJF3, sJF4; // Jitter factors var sDelay = 18; // Speed of scroll routine var sTimeout; // Timeout handle of scroll routine // // Draw transformed line in 2D-context cc from (x1,y1) to (x2,y2) // // [Dimensions taken from global canvas sC] // [Using global jitter factor sJF1 - sJF4] // [Using global scale factor sScale and character position (sCX/sCY)] // function sDrwLine(cc, x1, y1, x2, y2) { var l1, l2, l3, l4; // Auxiliary var ss1, ss2; // Sine FX l1=x1*sScale + sCX + sJF1; l2=y1*sScale + sCY + sJF2; l3=x2*sScale + sCX + sJF3; l4=y2*sScale + sCY + sJF4; // Make cool sine scroll... ss1 = Math.sin((l1-sC.width/2)/16)*sScale/1.2 * Math.sin((l1-sC.width/2)/196)*sScale/1.2; ss2 = Math.sin((l3-sC.width/2)/16)*sScale/1.2 * Math.sin((l3-sC.width/2)/196)*sScale/1.2; if ((l1<(sC.width-16)) && (l3<(sC.width-16))) { // Avoid right border clipping cc.beginPath(); cc.moveTo(l1, l2+ss1); cc.lineTo(l3, l4+ss2); cc.stroke(); } } // // Re-calculate jitter for character c // // [Using global jitter factor sJF1 - sJF4] // function sJitter(c) { if(c!='^') { // New distortion triggered sJF1=(Math.random()-0.5)*2.5; sJF2=(Math.random()-0.5)*2.6; sJF3=(Math.random()-0.5)*2.5; sJF4=(Math.random()-0.5)*2.6; } else { // Dampen distortion sJF1=sJF1*0.995; sJF2=sJF2*0.995; sJF3=sJF3*0.995; sJF4=sJF3*0.995; } } // // Draw character c in given context cc // // [Dimensions taken from global canvas sC] // [Using global character position sCX] // [Using global scale factor sScale] // function sDrwChar (cc, c) { var width = 0; // Width of character in scaling units if ((sCX<1) || (sCX>sC.width+sScale*20)) { // Nothing to draw here: Out of range! switch(c) { case 'i': case '1': width=1; break; case ' ': width=1.5; break; default: width=2; break; } sCX=sCX + (width+1)*sScale; return; } // Slow pace jitter if (Math.floor(sCX)%101==0) sJitter(c); else sJitter('^'); switch (c) { case '0': sDrwLine(cc, 0, 0, 0, 2); sDrwLine(cc, 0, 2, 1, 2); sDrwLine(cc, 1, 2, 1, 0); sDrwLine(cc, 1, 0, 0, 0); width = 2; break; case '1': sDrwLine(cc, 0, 0, 0, 2); width = 1; break; case '2': sDrwLine(cc, 0, 0, 1, 0); sDrwLine(cc, 1, 0, 1, 1); sDrwLine(cc, 1, 1, 0, 1); sDrwLine(cc, 0, 1, 0, 2); sDrwLine(cc, 0, 2, 1, 2); width = 2; break; case '3': sDrwLine(cc, 0, 0, 1, 0); sDrwLine(cc, 1, 0, 1, 1); sDrwLine(cc, 1, 1, 0, 1); sDrwLine(cc, 1, 1, 1, 2); sDrwLine(cc, 0, 2, 1, 2); width = 2; break; case '4': sDrwLine(cc, 0, 0, 0 ,1); sDrwLine(cc, 0, 1, 1, 1); sDrwLine(cc, 1, 0, 1, 2); width = 2; break; case '5': sDrwLine(cc, 0, 0, 1, 0); sDrwLine(cc, 0, 0, 0 ,1); sDrwLine(cc, 0, 1, 1, 1); sDrwLine(cc, 1, 1, 1, 2); sDrwLine(cc, 1, 2, 0, 2); width = 2; break; case '6': sDrwLine(cc, 0, 0, 1, 0); sDrwLine(cc, 0, 0, 0 ,2); sDrwLine(cc, 0, 1, 1, 1); sDrwLine(cc, 1, 1, 1, 2); sDrwLine(cc, 1, 2, 0, 2); width = 2; break; case '7': sDrwLine(cc, 0, 0, 1, 0); sDrwLine(cc, 1, 0, 1 ,2); width = 2; break; case '8': sDrwLine(cc, 0, 0, 1, 0); sDrwLine(cc, 0, 0, 0 ,2); sDrwLine(cc, 0, 1, 1, 1); sDrwLine(cc, 1, 0, 1, 2); sDrwLine(cc, 0, 2, 1, 2); width = 2; break; case '9': sDrwLine(cc, 0, 0, 1, 0); sDrwLine(cc, 0, 0, 0 ,1); sDrwLine(cc, 0, 1, 1, 1); sDrwLine(cc, 1, 0, 1, 2); width = 2; break; case 'a': sDrwLine(cc, 0, 2, 1, 0); sDrwLine(cc, 1, 0, 2, 0); sDrwLine(cc, 1.0/2.0, 1, 3.0/2.0, 1); sDrwLine(cc, 2, 0, 1, 2); width = 2; break; case 'b': sDrwLine(cc, 1, 0, 0, 2); sDrwLine(cc, 1.0/2.0, 1, 3.0/2.0, 1); sDrwLine(cc, 1, 0, 2, 0); sDrwLine(cc, 0, 2, 1, 2); sDrwLine(cc, 2, 0, 3.0/2.0, 1); sDrwLine(cc, 3.0/2.0, 1, 1, 2); width = 2; break; case 'c': sDrwLine(cc, 1, 0, 0, 2); sDrwLine(cc, 1, 0, 2, 0); sDrwLine(cc, 0, 2, 1, 2); width = 2; break; case 'd': sDrwLine(cc, 0, 2, 1, 0); sDrwLine(cc, 0, 2, 1, 2); sDrwLine(cc, 1, 2, 3.0/2.0, 1); sDrwLine(cc, 3.0/2.0, 1, 1, 0); width = 2; break; case 'e': sDrwLine(cc, 0, 2, 1, 0); sDrwLine(cc, 1, 0, 2, 0); sDrwLine(cc, 1.0/2.0, 1, 3.0/2.0, 1); sDrwLine(cc, 0, 2, 1, 2); width = 2; break; case 'f': sDrwLine(cc, 0, 2, 1, 0); sDrwLine(cc, 1, 0, 2, 0); sDrwLine(cc, 1.0/2.0, 1, 3.0/2.0, 1); width = 2; break; case 'g': sDrwLine(cc, 1, 0, 0, 2); sDrwLine(cc, 1, 0, 2, 0); sDrwLine(cc, 0, 2, 1, 2); sDrwLine(cc, 1, 2, 3.0/2.0, 1); sDrwLine(cc, 1, 1, 3.0/2.0, 1); width = 2; break; case 'h': sDrwLine(cc, 1, 0, 0, 2); sDrwLine(cc, 1, 2, 2, 0); sDrwLine(cc, 1.0/2.0, 1, 3.0/2.0, 1); width = 2; break; case 'i': sDrwLine(cc, 1, 0, 0, 2); width = 1; break; case 'j': sDrwLine(cc, 0, 2, 1, 2); sDrwLine(cc, 1, 2, 2, 0); width = 2; break; case 'k': sDrwLine(cc, 1, 0, 0, 2); sDrwLine(cc, 1.0/2.0, 1, 2, 0); sDrwLine(cc, 1.0/2.0, 1, 1, 2); width = 2; break; case 'l': sDrwLine(cc, 1, 0, 0, 2); sDrwLine(cc, 0, 2, 1, 2); width = 2; break; case 'm': sDrwLine(cc, 0, 2, 1, 0); sDrwLine(cc, 1, 0, 1, 1); sDrwLine(cc, 1, 1, 2, 0); sDrwLine(cc, 2, 0, 1, 2); width = 2; break; case 'n': sDrwLine(cc, 0, 2, 1, 0); sDrwLine(cc, 1, 0, 1, 2); sDrwLine(cc, 1, 2, 2, 0); width = 2; break; case 'o': sDrwLine(cc, 1, 0, 0, 2); sDrwLine(cc, 0, 2, 1, 2); sDrwLine(cc, 1, 2, 2, 0); sDrwLine(cc, 2, 0, 1, 0); width = 2; break; case 'p': sDrwLine(cc, 0, 2, 1, 0); sDrwLine(cc, 1, 0, 2, 0); sDrwLine(cc, 1.0/2.0, 1, 3.0/2.0, 1); sDrwLine(cc, 2, 0, 3.0/2.0, 1); width = 2; break; case 'q': sDrwLine(cc, 1, 0, 0, 2); sDrwLine(cc, 0, 2, 1, 2); sDrwLine(cc, 1, 2, 2, 0); sDrwLine(cc, 2, 0, 1, 0); sDrwLine(cc, 1, 2, 1, 1); width = 2; break; case 'r': sDrwLine(cc, 0, 2, 1, 0); sDrwLine(cc, 1, 0, 2, 0); sDrwLine(cc, 1.0/2.0, 1, 3.0/2.0, 1); sDrwLine(cc, 1.0/2.0, 1, 1, 2); sDrwLine(cc, 2, 0, 3.0/2.0, 1); width = 2; break; case 's': sDrwLine(cc, 0, 2, 1, 2); sDrwLine(cc, 1, 2, 1, 0); sDrwLine(cc, 1, 0, 2, 0); width = 2; break; case 't': sDrwLine(cc, 3.0/2.0, 0, 1.0/2.0, 2); sDrwLine(cc, 1, 0, 2, 0); width = 2; break; case 'u': sDrwLine(cc, 0, 2, 1, 0); sDrwLine(cc, 0, 2, 1, 2); sDrwLine(cc, 1, 2, 2, 0); width = 2; break; case 'v': sDrwLine(cc, 1.0/2.0, 2, 1, 0); sDrwLine(cc, 1.0/2.0, 2, 2, 0); width = 2; break; case 'w': sDrwLine(cc, 0, 2, 1, 0); sDrwLine(cc, 0, 2, 1, 1); sDrwLine(cc, 1, 1, 1, 2); sDrwLine(cc, 2, 0, 1, 2); width = 2; break; case 'x': sDrwLine(cc, 0, 2, 2, 0); sDrwLine(cc, 1, 0, 1, 2); width = 2; break; case 'y': sDrwLine(cc, 1.0/2.0, 2, 1, 1); sDrwLine(cc, 1, 1, 1, 0); sDrwLine(cc, 1, 1, 2, 0); width = 2; break; case 'z': sDrwLine(cc, 1, 0, 2, 0); sDrwLine(cc, 2, 0, 0, 2); sDrwLine(cc, 0, 2, 1, 2); width = 2; break; case ' ': width = 1.5; break; case '-': sDrwLine(cc, 0, 1, 1, 1); width = 2; break; case '/': sDrwLine(cc, 0, 2, 1, 0); width = 2; break; case '.': sDrwLine(cc, 0, 2, 0, 2); width = 2; break; case ',': sDrwLine(cc, 0, 2, 0, 3); width = 2; break; case '_': sDrwLine(cc, 0, 2, 1, 2); width = 2; break; case ':': sDrwLine(cc, 1.0/2.0, 1.0/2.0, 1.0/2.0+0.33, 1.0/2.0+0.1); sDrwLine(cc, 1.0/2.0, 3.0/2.0, 1.0/2.0+0.33, 3.0/2.0+0.1); width = 2; break; } // Advance character position sCX = sCX + (width+1)*sScale; } // // Draw string s in given context cc // // [Using global character and scroll positions (sCX/sCY), (sX/sY)] // function sDrwString(cc, s) { var i = 0; sCX=sX; sCY=sY; for (i=0; i