http://new.weavesilk.com/
könnt ihr euch mal anschauen, ist echt mega entspannt da mal rumzugurken aus Langeweile
(Eine AutoIt Umsetzung wäre interessant (UEZ, minx, Marsi, ... ?))
MfG
Zeichnen like a Boss
-
-
Schaut echt schön aus! :>
Gleich mal Lesezeichen gesetzt.Habs am Smartphone ausprobiert, es funktioniert perfekt am Smartphone (Lappi ist derzeit außer Betrieb >.<)
Mfg
-
Wow das sieht echt toll aus. Wäre wirklich interessant mit AutoIt umzusetzen. Das stelle ich mir allerdings nicht ganz einfach vor.
Gruss Shadowigor
-
Geilo .. erstmal n neuen Hintergrund erstellen nach der arbeit
-
Versucht mal das ganze mit Euren Smartphones
Da bekommt na ECHT Geniales zeuchs hin...Leider kann ichs nicht Screenen Sonnst könnt ich hier 3-4 Bilder Posten.*Edit*
[Blockierte Grafik: https://dl.dropbox.com/u/49201990/Pic%27s/Try.jpg]
Hab ich grad eben mir der Maus gemacht -
Hahahaha nice, sieht aus wie ein ... Hasen-etwas-seltsam
-
du kannst aber oben auf Share gehen und dann sehen wir zb wie du gezeichnet hast:
z.B. [Blockierte Grafik: http://img5.fotos-hochladen.net/thumbnail/20130208135iagv6cx57k_thumb.jpg]
-
Nette Spielerei, leider kann ich nicht gezielt damit was zeichnen.
Wer ungewöhnliche Grafikprogramme mag, sollte auch mal Sculptris antesten (ist ähnlich Zbrush, aber gratis).
http://www.pixologic.com/sculptris/# -
Sculptris? Kenn ich nicht, und auch beim Überfliegen der seite Ähnelt dass stark einem CAD Programm, genaueres kann man erst sagen wen man damit gearbeitet hat.
Aber bei solchen Dingen bleibe ich ganz ehrlich bei meinem CAD Programm, da kenn ich alles, weiss wie was wo und muss nicht noch lehrnen wie mit dem programm umzugehen ist
Ansonsten sieht das Programm sehr interessant aus, Danke für die info ohforf -
Die Spielerei mit Sculptris oder Zbrush ähnelt eher dem Umgang mit Knetmasse.
CAD ist eigentlich was gaaanz anderes. -
Coole seite!^^ damit kann man endlich mal so tun als ob man was professionelles macht xDD
http://new.weavesilk.com/?vghn
n Smiley^^mfg
Hauke -
Êin farbenspiel der besonderen, extravaganten Klasse. Diese herausragenden und sich schlängelnden Linien, die den Nutzer vorgaukeln, er sei ein kreatives Individuum erregt mich kognitiv sehr. http://new.weavesilk.com/?vi8u
-
Hi,
ZitatWow das sieht echt toll aus. Wäre wirklich interessant mit AutoIt umzusetzen. Das stelle ich mir allerdings nicht ganz einfach vor.
sieht mir anhand der Stützstellen nach B-Spline aus.
Die Mausposition wird abgefragt, und an dieser Position werden einige Punkte erstellt, die sich auf zufälligen Bahnen vom Mauspunkt wegbewegen und irgendwann "sterben".
Jetzt muss man nur noch von den "überlebenden" Punkten zufällig 4 auswählen und anhand dieser den B-spline erstellen. Einen oder zwei der "Überlebenden" nimmt man dann wieder als Startpunkt, welcher wiederum neue Punkte generiert, die sich vom Startpunkt wegbewegen....uswusfKommt nicht ganz hin, aber so ähnlich....die GDI-Fuzzis machen da bestimmt noch ne Show draus^^
Spoiler anzeigen
[autoit]#include <GuiConstantsEx.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <GDIPlus.au3>;linke maustaste gedrückt halten zeichnet sich bewegende splines durch die vergangenen Mauspositionen
[/autoit] [autoit][/autoit] [autoit]
;rechte maustaste resettet den startpunkt$anzahl = 7 ;anzahl der stützpunkte des splines
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]Local $hGUI, $hWnd, $hGraphic, $aPoints[$anzahl + 1][2]
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
Dim $x[$anzahl + 1], $y[$anzahl + 1]
$aPoints[0][0] = $anzahl; Erstellt eine GUI
[/autoit] [autoit][/autoit] [autoit]
$hGUI = GUICreate("Paint Me :o)", 800, 800)
$hWnd = WinGetHandle($hGUI)
GUISetState(); Zeichnet eine Spline
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
Opt("MouseCoordMode", 0)MouseMove(300, 300, 0)
[/autoit] [autoit][/autoit] [autoit]
;ursprung
For $i = 1 To $anzahl ;mauskoordinaten in alle punkte des splines
$x[$i] = MouseGetPos(0)
$y[$i] = MouseGetPos(1)
Next$xalt = MouseGetPos(0)
[/autoit] [autoit][/autoit] [autoit]
$yalt = MouseGetPos(1)$col = 0xFF00FF00
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
$down = 0
$reset = 0While 1
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
$a = GUIGetMsg()
If $a = -3 Then ExitLoop
If $a = $GUI_EVENT_PRIMARYDOWN Then $down = 1;linke maustaste runter
If $a = $GUI_EVENT_PRIMARYup Then $down = 0;linke maustaste hoch
If $a = $GUI_EVENT_SECONDARYDOWN Then $reset = 1;rechte maustaste zum resettenIf $down Then ;linke maustaste gedrückt
[/autoit] [autoit][/autoit] [autoit]
Sleep(10) ;verlängern !If $reset = 1 Then ;resettet den startpunkt
[/autoit] [autoit][/autoit] [autoit]
$reset = 0
For $i = 1 To $anzahl
$x[$i] = MouseGetPos(0)
$y[$i] = MouseGetPos(1)
Next$xalt = MouseGetPos(0)
[/autoit] [autoit][/autoit] [autoit]
$yalt = MouseGetPos(1)
$col = 0xFF000000 + Random(0xFFFF, 0xFFFFFF, 1) ;neue farbe
EndIf$xneu = MouseGetPos(0);neue mauskkordinaten
[/autoit] [autoit][/autoit] [autoit]
$yneu = MouseGetPos(1)If $xalt <> $xneu Or $yalt <> $yneu Then ;wenn mausposition geändert, neue mausposition in koordinaten einbauen
[/autoit] [autoit][/autoit] [autoit]
$xalt = $xneu
$yalt = $yneu
For $i = 1 To $anzahl - 2
$x[$i] = $x[$i + 1]
$y[$i] = $y[$i + 1]
$aPoints[$i][0] = $x[$i]
$aPoints[$i][1] = $y[$i]
Next
$x[$anzahl - 1] = MouseGetPos(0) ;vorletzter punkt = mauskoordinaten
$y[$anzahl - 1] = MouseGetPos(1)
$x[$anzahl] = $x[1];letzter Punkt = erster Punkt = spline geschlossen
$y[$anzahl] = $y[1]$col = 0xFF000000 + Random(0xFFFF, 0xFFFFFF, 1) ;neue farbe
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
$hpen = _GDIPlus_PenCreate($col)
EndIfFor $i = 1 To $anzahl - 1;jede runde die koordinaten zufällig bewegen
[/autoit] [autoit][/autoit] [autoit]
$v = Random(-10, 10, 1);2 richtungen vertikal
$h = Random(-10, 10, 1);2 richtungen horizontal
$x[$i] += $v
$y[$i] += $h
$aPoints[$i][0] = $x[$i]
$aPoints[$i][1] = $y[$i]
Next
$aPoints[$anzahl][0] = $x[1] ;letzter punkt = erster punkt = spline geschlossen
$aPoints[$anzahl][1] = $y[1]$col += 100 ;farbe verändern
[/autoit] [autoit][/autoit] [autoit]
$hpen = _GDIPlus_PenCreate($col)
_GDIPlus_GraphicsDrawCurve($hGraphic, $aPoints, $hpen)EndIf
[/autoit] [autoit][/autoit] [autoit]WEnd
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]; Ressourcen freigeben
[/autoit]
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown() -
Naja, hier mal ein entstandenes Bild xD
[Blockierte Grafik: http://www.workupload.com/image/AlJGCt5]
-
Wer Lust und Zeit hat, kann diesen JS Code auseinander frimmeln und ihn nach AutoIt portieren:
silk.js
Spoiler anzeigen
Code
Alles anzeigen(function(){var J={}.hasOwnProperty,h=function(a,b){function c(){this.constructor=a}for(var e in b)J.call(b,e)&&(a[e]=b[e]);c.prototype=b.prototype;a.prototype=new c;a.__super__=b.prototype;return a},G=function(a,b){return function(){return a.apply(b,arguments)}},y=[].slice;this.SilkDomain="http://new.weavesilk.com";this.rand=Math.random;this.max=Math.max;this.min=Math.min;this.abs=Math.abs;this.round=Math.round;this.floor=Math.floor;this.ceil=Math.ceil;this.log=Math.log;this.pow=Math.pow;this.sin= Math.sin;this.cos=Math.cos;this.sqrt=Math.sqrt;this.atan2=Math.atan2;this.Pi=Math.PI;this.TwoPi=2*Pi;this.HalfPi=Pi/2;this.QuarterPi=Pi/4;this.EighthPi=Pi/8;this.E=Math.E;this.Epsilon=1E-4;this.Paused=!1;this.hexToRGB=function(a){var b,c,e;b=/^#?([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/i.exec(a).slice(1);e=[];for(a=c=0;2>=c;a=++c)e.push(parseInt(b[a],16));return e};this.brightenRGB=function(a,b,c,e){return[floor(min(255,a+255*e)),floor(min(255,b+255*e)),floor(min(255,c+255*e))]};this.constrain=function(a, b,c){return a>c?c:a<b?b:a};this.randrange=function(a,b){return a+rand()*(b-a)};var H;H=0;this.autoinc=function(){return H++};this.d=function(){return"undefined"!==typeof console&&null!==console?console.log.apply(console,Array.prototype.slice.call(arguments)):void 0};this.requestAnimFrame=this.requestAnimationFrame||this.webkitRequestAnimationFrame||this.mozRequestAnimationFrame||this.oRequestAnimationFrame||this.msRequestAnimationFrame||function(a){return this.setTimeout(a,1E3/60)};this.cancelAnimFrame= this.cancelAnimationFrame||this.webkitCancelAnimationFrame||this.mozCancelAnimationFrame||this.oCancelAnimationFrame||this.msCancelAnimationFrame||this.clearTimeout;var m=function(a){this.maxParticles=null!=a?a:500;this.start=this.end=0;this.all=Array(this.maxParticles)};m.prototype["new"]=function(){return{age:0,alive:!0}};m.prototype.shouldNotExist=function(){return this.start===this.end};m.prototype.exist=function(a){for(;!(this.start===this.end||this.all[this.start].alive);)this.all[this.start]= null,this.start=this.inc(this.start);if(!this.shouldNotExist())return this.foreach(function(a){a.px=a.x;a.py=a.y;a.age+=1;return this.update(a)}),this.drawAll(a)};m.prototype.drawAll=function(a){var b,c,e,f,j;if(!this.shouldNotExist()&&("function"===typeof this.drawStart&&this.drawStart(a),this.foreach(function(b){if(b.alive)return this.draw(b,a)}),"function"===typeof this.drawEnd&&this.drawEnd(a),this.symmetries)){f=this.symmetries;j=[];c=0;for(e=f.length;c<e;c++)b=f[code=c],this.foreach(b.trans),"function"=== typeof this.drawStart&&this.drawStart(a),this.foreach(function(b){if(b.alive)return this.draw(b,a)}),"function"===typeof this.drawEnd&&this.drawEnd(a),j.push(this.foreach(b.inv));return j}};m.prototype.foreach=function(a){var b;for(b=this.start;b!==this.end;)a.call(this,this.all[b]),b=this.inc(b)};m.prototype.add=function(a,b){var c,e;c=this.inc(this.end);this.start===c&&(this.start=this.inc(this.start));e=this["new"]();e.x=a;e.y=b;this.all[this.end]=e;this.end=c;return e};m.prototype.inc=function(a){return(a+ 1)%this.maxParticles};m.prototype.dec=function(a){return(a-1)%this.maxParticles};this.Particles=m;var l=function(){l.__super__.constructor.apply(this,arguments)};h(l,Particles);l.prototype["new"]=function(){return $.extend(l.__super__["new"].call(this),{r:255,g:255,b:255,maxA:1,radius:0.75,vx:randrange(-1,1),vy:randrange(-1,0),dieAt:25,fadeIn:!1})};l.prototype.update=function(a){var b;a.x+=a.vx;a.y+=a.vy;b=1-a.age/a.dieAt;a.a=a.fadeIn?a.maxA*sin(Pi*b):b;a.color="rgba("+a.r+", "+a.g+", "+a.b+", "+ a.a+")";return a.alive&&(a.alive=a.age<a.dieAt)};l.prototype.draw=function(a,b){if(a.alive)return b.beginPath(),b.fillStyle=a.color,b.arc(a.x,a.y,a.radius,0,TwoPi,!1),b.fill(),b.closePath()};l.prototype.addFromSilk=function(a){var b=this;a.foreach(function(c){var e;if(0.03>rand())return c=b.add(c.x,c.y),e=a.sparkRGB,c.r=e[0],c.g=e[1],c.b=e[2],e})};l.prototype.addClear=function(a,b,c){var e,f,j,B,k,g;null==b&&(b=100);null==c&&(c=1);f=a.width/2;j=a.height/2;for(g=1;1<=b?g<=b:g>=b;1<=b?++g:--g)B=randrange(0, a.width),k=randrange(0,a.height),e=atan2(k-j,B-f),e+=randrange(-QuarterPi,QuarterPi),k=this.add(B,k),B=0.25*c,k.vx=B*cos(e),k.vy=B*sin(e),k.dieAt=randrange(25,85)};this.Sparks=l;var g=function(a,b,c,e){this.canvas=a;this.width=b;this.height=c;this.seed=e;g.__super__.constructor.call(this);this.offx=(this.width-window.innerWidth)/2;this.offy=(this.height-window.innerHeight)/2;this.age=0;this.alive=!0;this.completed=!1;this.setParams(g.defaultParams);this.perlin=new PerlinNoise(0);this.color={r:255, g:255,b:255,a:0.07};this.sparkRGB=[255,255,255];this.num=0};h(g,Particles);g.prototype.setSymmetryTypes=function(a){var b,c,e,f,j=this;f=[];c=0;for(e=a.length;c<e;c++)switch(b=a[code=c],b){case "vertical":f.push({trans:function(a){return a.x=j.canvas.width-a.x}});break;case "horizontal":f.push({trans:function(a){return a.y=j.canvas.height-a.y}});break;case "diagonal":f.push({trans:function(a){a.x=j.canvas.width-a.x;return a.y=j.canvas.height-a.y}});break;default:f.push(void 0)}e=this.symmetries=f;b=0; for(c=e.length;b<c;b++)a=e[b],null==a.inv&&(a.inv=a.trans)};g.prototype["new"]=function(){return $.extend(g.__super__["new"].call(this),{accx:0,accy:0,friction:this.friction,mass:1,springLength:this.springLength,rigidity:this.rigidity,death:250})};g.prototype.add=function(a,b,c,e){var f;f=this.start===this.end;a=g.__super__.add.call(this,a-this.offx,b-this.offy);f||(this.prevParticle.next=a);f=this.mouseDamp;this.reverseMouseVelocity&&(f*=-1);a.vmx=c*f;a.vmy=e*f;a.num=this.num++;return this.prevParticle= a};g.prototype.shouldNotExist=function(){return g.__super__.shouldNotExist.call(this)||!this.alive};g.prototype.exist=function(){g.__super__.exist.apply(this,arguments);if(this.completed&&(this.color.a-=5E-4,this.color.a<Epsilon))return this.die()};g.prototype.update=function(a){var b,c;noiseDetail(this.noiseOctaves,this.noiseFallout);c=2*TwoPi*noise((a.x+this.offx)*this.noiseScale,(a.y+this.offy)*this.noiseScale,this.seed+0.008*this.age,this.perlin);c*=2;b=Pi/2;(0!==a.vmx||0!==a.vmy)&&atan2(a.vmx, a.vmy);this.addAngleForce(a,c+b,1);this.addForce(a,a.vmx,a.vmy);a.vmx*=0.99;a.vmy*=0.99;a.rigidity*=0.999;this.wind&&this.addAngleForce(a,this.windAngle,this.windForce);null!=a.next&&(this.move(a),this.constrain(a));return a.alive&&(a.alive=a.age<a.death)};g.prototype.move=function(a){a.x+=(a.x-a.px)*a.friction+a.accx;a.y+=(a.y-a.py)*a.friction+a.accy;return a.accx=a.accy=0};g.prototype.addForce=function(a,b,c){a.accx+=b/a.mass;return a.accy+=c/a.mass};g.prototype.addAngleForce=function(a,b,c){c/= a.mass;a.accx+=c*cos(b);return a.accy+=c*sin(b)};g.prototype.addPosition=function(a,b,c){a.x+=b;return a.y+=c};g.prototype.constrain=function(a){var b,c,e;c=a.next.x-a.x;e=a.next.y-a.y;b=Math.sqrt(c*c+e*e);if(0!==b&&(b=1-a.springLength/b,c=a.rigidity*c*b,e=a.rigidity*e*b,this.addPosition(a,c,e),null!=a.next.next))return this.addPosition(a.next,-c,-e)};g.prototype.drawStart=function(a){var b;a.beginPath();b=this.all[this.start];return 1===this.drawScale?a.moveTo(b.x*this.drawScale,b.y*this.drawScale): a.moveTo((b.x-window.innerWidth/2)*this.drawScale+window.innerWidth/2,(b.y-window.innerHeight/2)*this.drawScale+window.innerHeight/2)};g.prototype.draw=function(a,b){var c,e,f,j;f=a.next;if(null!=(null!=f?f.next:void 0)){if(1===this.drawScale)return b.quadraticCurveTo(a.x*this.drawScale,a.y*this.drawScale,(a.x*this.drawScale+f.x*this.drawScale)/2,(a.y*this.drawScale+f.y*this.drawScale)/2);c=(a.x-window.innerWidth/2)*this.drawScale+window.innerWidth/2;e=(a.y-window.innerHeight/2)*this.drawScale+window.innerHeight/ 2;j=(f.x-window.innerWidth/2)*this.drawScale+window.innerWidth/2;f=(f.y-window.innerHeight/2)*this.drawScale+window.innerHeight/2;return b.quadraticCurveTo(c,e,(c+j)/2,(e+f)/2)}};g.prototype.drawEnd=function(a){a.lineWidth=this.drawScale;a.strokeStyle="rgba("+this.color.r+", "+this.color.g+", "+this.color.b+", "+this.color.a+")";a.stroke();return a.closePath()};g.prototype.setParams=function(a){return $.extend(this,a)};g.prototype.setRGB=function(a,b,c){this.color.r=a;this.color.g=b;this.color.b= c;return this.sparkRGB=brightenRGB(a,b,c,0.3)};g.prototype.tick=function(){return this.age+=1};g.prototype.complete=function(){return this.completed=!0};g.prototype.die=function(){return this.alive=!1};g.originalParams={noiseOctaves:8,noiseFallout:0.65,noiseScale:0.01,wind:!1,windAngle:-Pi,windForce:0.75,friction:0.975,springLength:0,rigidity:0.3,reverseMouseVelocity:!1,mouseDamp:0.2};g.randomParams=function(){return{noiseOctaves:randrange(2,9),noiseFallout:randrange(0.25,1),noiseScale:randrange(0.001, 0.1),wind:0.5>rand(),windAngle:randrange(0,TwoPi),windForce:randrange(0.5,1),friction:randrange(0,1),springLength:randrange(0,20),rigidity:randrange(0,1),reverseMouseVelocity:0.5>rand(),mouseDamp:randrange(0,1)}};g.defaultParams=g.originalParams;g.setDefaultParams=function(a){this.defaultParams=a};g.resetDefaultParams=function(){return this.setDefaultParams(this.originalParams)};this.Silk=g;h=function(a,b,c){this.getPictureURL=G(this.getPictureURL,this);this.toBlob=G(this.toBlob,this);var e=this; this.silkOne=$(a)[0];this.silkTwo=$(b)[0];this.silkCanvas=this.silkOne;this.bufferCanvas=this.silkTwo;this.sparksCanvas=$(c)[0];this.silks={};this.time=0;this.pristine=ko.observable(!0);this.dirty=ko.observable(!1);this.undoState=ko.observable(null);this.canUndo=ko.computed(function(){return null!=e.undoState()&&!e.dirty()});this.tape=new Tape(this);this.replay=new Tape(this);this.sparks=new Sparks;this.replayUrl=ko.observable("");this.saving=ko.observable(!1);this.setRGB("dd4876");this.setSymmetryTypes("vertical"); this.drawScale=1};h.prototype.load=function(a){var b=this;$.ajax({type:"GET",url:"/v1/load",data:{id:a},success:function(a){a=JSON.parse(a);b.replay=new Tape(b);return b.replay.load(a)}});return this.replayUrl("/?"+a)};h.prototype.save=function(){var a,b=this;a=JSON.stringify(this.tape.get());$.ajax({type:"POST",url:"/v1/save",data:{contents:a},success:function(a){b.replayUrl("/?"+a);return b.saving(!1)}});return this.saving(!0)};h.prototype.toBlob=function(){return this.silkCanvas.toBlob(function(a){return saveAs(a, "silk.png")})};h.prototype.getPictureURL=function(){var a,b,c,e,f,j;a=this.silkCanvas;c=a.getContext("2d");j=a.width;f=a.height;e=c.getImageData(0,0,j,f);b=c.globalCompositeOperation;c.globalCompositeOperation="destination-over";c.fillStyle="#000";c.fillRect(0,0,j,f);a=a.toDataURL("image/png");c.clearRect(0,0,j,f);c.putImageData(e,0,0);c.globalCompositeOperation=b;return a};h.prototype.swapSilkCanvii=function(){this.silkCanvas===this.silkOne?(this.bufferCanvas=this.silkOne,this.silkCanvas=this.silkTwo): (this.silkCanvas=this.silkOne,this.bufferCanvas=this.silkTwo);$(this.silkCanvas).insertBefore($(this.bufferCanvas));$(this.silkCanvas).addClass("active");return $(this.bufferCanvas).removeClass("active")};h.prototype.add=function(a,b,c,e,f,j){var g;null==a&&(a=(new Date).getTime());null==b&&(b=this.rgb);null==c&&(c=this.symmetryTypes);null==e&&(e=this.silkCanvas.width);null==f&&(f=this.silkCanvas.height);null==j&&(j=randrange(0,1E6)|0);this.tape.recStart();this.tape.rec("add",a,b,c,e,f,j);this.silks[a]= new Silk(this.silkCanvas,e,f,j);this.silks[a].drawScale=this.drawScale;(g=this.silks[a]).setRGB.apply(g,b);this.silks[a].setSymmetryTypes(c);this.dirty(!0);this.pristine(!1);return a};h.prototype.addPoint=function(a,b,c,e,f){var j;this.tape.rec("addPoint",a,b,c,e,f);return null!=(j=this.silks[a])?j.add(b,c,e,f):void 0};h.prototype.complete=function(a){var b,c,e;if(null!=this.silks[a]&&!this.silks[a].completed){this.tape.rec("complete",a);this.silks[a].complete();b=!0;e=this.silks;for(a in e)if(c= e[a],!c.completed){b=!1;break}if(b&&(this.tape.recStop(),10<this.tape.time-this.tape.startedTime))return this.tape.advance(15)}};h.prototype.clear=function(){var a,b;if(this.dirty()){b=this.tape.eject();this.replay.eject();this.undoState({time:this.time,tapeContents:b,replayUrl:this.replayUrl()});this.replayUrl("");b=this.silks;for(a in b)this.complete(a);this.silks={};this.dirty(!1);this.time=0;a=this.bufferCanvas.getContext("2d");a.clearRect(0,0,this.bufferCanvas.width,this.bufferCanvas.height); $(this.silkCanvas).addClass("hidden");$(this.bufferCanvas).removeClass("hidden");this.swapSilkCanvii()}return this.sparks.addClear(this.sparksCanvas,100)};h.prototype.undoClear=function(){var a;if(this.canUndo())return a=this.undoState(),this.time=a.time,this.tape.load(a.tapeContents),this.replayUrl(a.replayUrl),this.undoState(null),this.dirty(!0),$(this.bufferCanvas).removeClass("hidden"),this.swapSilkCanvii(),this.sparks.addClear(this.sparksCanvas,100,-1)};h.prototype.exist=function(){var a,b,c, e,f,j;c=this.silkCanvas.getContext("2d");e=this.sparksCanvas.getContext("2d");c.globalCompositeOperation="lighter";j=this.silks;for(a in j)if(b=j[a],b.alive){this.sparks.addFromSilk(b);for(f=1;6>=f;++f)b.exist(c);b.tick()}else delete this.silks[a];e.clearRect(0,0,this.sparksCanvas.width,this.sparksCanvas.height);this.sparks.exist(e);this.replay.play();this.tape.recording&&this.tape.tick();this.replay.tick();return this.tick()};h.prototype.tick=function(){return this.time+=1};h.prototype.setRandomParams= function(a){null==a&&(a=Silk.randomParams());return Silk.setDefaultParams(a)};h.prototype.unsetRandomParams=function(){return Silk.resetDefaultParams()};h.prototype.setSymmetryTypes=function(){return this.symmetryTypes=1<=arguments.length?y.call(arguments,0):[]};h.prototype.setRGB=function(a){return this.rgb=hexToRGB(a)};this.Silks=h;ZeroClipboard.setMoviePath(SilkDomain+"/js/ZeroClipboard.swf");this.initControls=function(a,b){var c,e,f,j,g,k,h,C,m,n,t,l,p,r,D,w,x,E,u,z,q,s,v,F;C=a.silkOne;E=a.silkTwo; u=a.sparksCanvas;initResizeHandler(C,E,u);l=n=u.width/2;p=t=u.height/2;z=q=s=0;m=!1;r=null;C=!1;try{(h=new ActiveXObject("ShockwaveFlash.ShockwaveFlash"))&&(C=!0)}catch(K){null!=navigator.mimeTypes["application/x-shockwave-flash"]&&(C=!0)}D=function(){b.start();m=!0;r=a.add();b.playDrawSound();k.ui.replayUrl("");return!1};c=$(u);w=function(a){var b,e;b=c.offset();e=b.left;b=b.top;n=a.pageX-e;return t=a.pageY-b};x=function(){m=!1;a.complete(r);return b.stopDrawSound()};$(document).mouseup(function(a){if(1=== a.which)return x()});$(u).mousedown(function(a){if(1===a.which)return k.ui.showAbout(!1),D()}).mousemove(function(a){return w(a)}).mouseup(function(a){if(1===a.which)return x()}).bind("touchstart",function(a){w(a.originalEvent.touches[0]||a.originalEvent.changedTouches[0]);l=n;p=t;D();return!1}).bind("touchmove",function(a){w(a.originalEvent.touches[0]||a.originalEvent.changedTouches[0]);return!1}).bind("touchend",function(){x();return!1});k={exist:function(){var b;m?(a.addPoint(r,n,t,n-l,t-p),q= l-n,s=p-t,b=q*q+s*s,z=0<b?sqrt(b):0):q=s=z=0;l=n;return p=t},vmouse:function(){return z},ui:{pristine:a.pristine,dirty:a.dirty,canUndo:a.canUndo,replayUrl:a.replayUrl,saving:a.saving,canClip:C,clipText:ko.observable("Copy link"),showSaveOverlay:ko.observable(!1),showAbout:ko.observable(!1),emailUrl:ko.computed(function(){return"mailto:?subject=Silk&body="+(SilkDomain+a.replayUrl())}),fbUrl:ko.computed(function(){var b;b=SilkDomain+a.replayUrl();return["https://www.facebook.com/dialog/feed?&app_id=408271179236250", "link="+b,"picture="+SilkDomain+"/img/fb_share_thumb.jpg","name=Silk&caption=&description=Create beautiful art with Silk, an interactive generative artwork.","redirect_uri="+b].join("&")}),twitterUrl:ko.computed(function(){return"https://twitter.com/share?url="+SilkDomain+a.replayUrl()}),muteMusic:b.muteMusic,muteSound:b.muteSound,symmetry:ko.observable(""),color:ko.observable(""),savePicture:function(){return a.toBlob()},setColor:function(a){k.ui.color(a);return b.blip()},setSymmetry:function(a){return k.ui.symmetry(a)}, share:function(){return a.save()},clear:function(){a.clear();r=null;b.playClearSound();return refreshCarbonAd()},undo:function(){b.blip(1.25);return a.undoClear()},randomize:function(){return a.setRandomParams()},unrandomize:function(){return a.unsetRandomParams()},toggleAbout:function(){return k.ui.showAbout(!k.ui.showAbout())},toggleMusic:function(){return b.muteMusic()?b.setMuteMusic(!1):b.setMuteMusic(!0)},toggleSound:function(){if(b.muteSound())return b.setMuteMusic(!1),b.setMuteEffects(!1); b.setMuteMusic(!0);return b.setMuteEffects(!0)},bloop:function(){return b.bloop()}}};e=new ZeroClipboard.Client;e.glue("copy-to-clipboard","copy-to-clipboard-wrap");a.replayUrl.subscribe(function(a){return e.setText(SilkDomain+a)});e.addEventListener("onMouseOver",function(){return k.ui.clipText("Copy link")});e.addEventListener("onComplete",function(){return k.ui.clipText("Copied.")});g={blue:"#3d95cc",green:"#53BD39",yellow:"#E3BF30",orange:"#EB5126",pink:"#dd4876",grey:"#555555"};j=ko.computed(function(){return g[k.ui.color()]}); k.ui.color.subscribe(function(b){sessionStorage.colorName=b;j=g[b];a.setRGB(j);return $("#colors").css("background-color",j)});for(f in g)h=g[f],$("#colors ."+f).css("background",h);k.ui.symmetry.subscribe(function(b){sessionStorage.symmetryKind=b;switch(b){case "none":return a.setSymmetryTypes();case "vertical":return a.setSymmetryTypes("vertical");case "both":return a.setSymmetryTypes("horizontal","vertical","diagonal")}});k.ui.color(null!=(v=sessionStorage.colorName)?v:"blue");k.ui.symmetry(null!= (F=sessionStorage.symmetryKind)?F:"vertical");key("x, space",function(){return k.ui.clear()});key("u",function(){return k.ui.undo()});return k};this.initResizeHandler=function(){var a,b;a=1<=arguments.length?y.call(arguments,0):[];b=function(){var b,e,f,j,g,k,h;h=[];g=0;for(k=a.length;g<k;g++)e=a[g],b=e.getContext("2d"),j=e.width,f=e.height,f=b.getImageData(0,0,j-1,f-1),b=$(window),e.width=b.width(),e.height=b.height(),b=e.getContext("2d"),h.push(b.putImageData(f,0,0));return h};b();return $(window).resize(b)}; h=function(a){this.source=a;this.load({})};h.prototype.recStart=function(){this.recording=!0;return this.startedTime=this.time};h.prototype.rec=function(){var a,b,c;a=1<=arguments.length?y.call(arguments,0):[];if(this.recording){if(null==(b=this.tape)[c=this.time])b[code=c]=[];return this.tape[this.time].push(a)}return d("Error: Not recording.",a)};h.prototype.recStop=function(){return this.recording=!1};h.prototype.advance=function(a){return this.time+=a};h.prototype.play=function(){var a,b,c,e,f,g;if(this.time in this.tape){f=this.tape[this.time];c=0;for(e=f.length;c<e;c++)a=f[code=c],b=a[0],a=2<=a.length?y.call(a,1):[],(g=this.source)[b].apply(g,a)}};h.prototype.tick=function(){return this.time+=1};h.prototype.load=function(a){this.tape=a;return this.time=0};h.prototype.get=function(){return this.tape};h.prototype.eject=function(){var a;a=this.tape;this.load({});return a};this.Tape=h;this.initAudio=function(){var a,b,c,e,f,g,h,k,l,m,y,n,t,A,p,r,D,w,x,E,u,z;this.audioContext=this.audioContext||this.webkitAudioContext; var q=function(a,b){this.buffer=a;this.ctx=b;this.setLoop(!1);this.setVolume(1)};q.prototype.setLoop=function(a){this.loop=a};q.prototype.setVolume=function(a){this.gain=a};q.prototype.createSource=function(){this.source=this.ctx.createBufferSource();this.source.buffer=this.buffer;this.source.loop=this.loop;this.source.gain.value=this.gain;return this.source.connect(this.ctx.destination)};q.prototype.play=function(){var a;return null!=(a=this.source)?a.noteOn(0):void 0};q.prototype.fadeTo=function(a, b){var c;this.gain=a;c=this.ctx.currentTime;this.source.gain.cancelScheduledValues(c);this.source.gain.setValueAtTime(this.source.gain.value,c);return this.source.gain.linearRampToValueAtTime(this.gain,c+b)};q.prototype.trigger=function(a){var b,c;null==a&&(a=1);b=this.triggerSource;this.triggerSource=this.triggerSourceBk;this.triggerSourceBk=b;null!=(c=this.triggerSource)&&c.noteOff(0);this.triggerSource=this.ctx.createBufferSource();this.triggerSource.buffer=this.buffer;this.triggerSource.loop= this.loop;this.triggerSource.gain.value=this.gain*a;this.triggerSource.connect(this.ctx.destination);return this.triggerSource.noteOn(0)};z=function(a){return"http://yurivish.com/Silk%20Static/srv.php?file=audio/"+escape(a)};t=function(a,b,c,e){var f;f=new XMLHttpRequest;f.open("GET",a,!0);f.responseType="arraybuffer";f.onload=function(){return b.decodeAudioData(f.response,function(a){return"function"===typeof c?c(a):void 0},function(){return"function"===typeof e?e(req,a):void 0})};return f.send()}; if(null!=this.audioContext){g=new this.audioContext;n=function(a,b){var c;c=z(a);return t(c,g,function(a){a=new q(a,g);return b(a)})};var s,v,F;s=[];F=function(a){a.setVolume(0.27);s.push(a);return 4===s.length};n("Clear 1 16-44.m4a",F);v=1;w=function(){var a;0<v&&(a=floor(randrange(0,s.length)),s[a].trigger());if(4>v)return n("Clear "+(v+1)+" 16-44.m4a",F),v+=1};k=null;n("Sparks 16-44 -looped.m4a",function(a){k=a;k.setVolume(0);k.setLoop(!0);k.createSource();return k.play()});l=null;n("Draw B2 2048 loop.m4a", function(a){l=a;l.setVolume(0);l.setLoop(!0);l.createSource();return l.play()});m=!1;x=function(){m=!0;null!=k&&k.fadeTo(0.02,0.5);return null!=l?l.fadeTo(0.15,0.5):void 0};u=function(){m=!1;null!=k&&k.fadeTo(0,1);return null!=l?l.fadeTo(0,1):void 0};A=function(a){if(m)return a=log(log(a*(1/30)+1)),a=constrain(a,0.15,0.6),null!=l?l.fadeTo(a,0.2):void 0};e=null;n("Palette A5.m4a",function(a){e=a;return e.setVolume(0.4)});f=null;n("Palette A4.m4a",function(a){f=a;return f.setVolume(0.3)})}r=ko.observable(null!= localStorage.getItem("muteMusic"));p=ko.observable(null!=localStorage.getItem("muteEffects"));D=ko.computed(function(){return r()&&p()});E=!1;a=$("#bg-music")[0];b=$("#bg-music-intro")[0];c=!1;y=function(){a.volume=0;a.play();return setTimeout(function(){var b;return b=setInterval(function(){a.volume+=0.5/150;a.volume=min(a.volume,0.5)+0.01;if(0.5<=a.volume)return clearInterval(b)},100)},500)};return h={muteMusic:r,muteSound:D,setMuteMusic:function(c){r(c);c?localStorage.setItem("muteMusic",!0):(localStorage.removeItem("muteMusic"), h.setMuteEffects(!1),h.start());b.muted=c;return a.muted=c},setMuteEffects:function(a){p(a);return a?localStorage.setItem("muteEffects",!0):localStorage.removeItem("muteEffects")},start:function(){var e;if(!E&&!r())return E=!0,e=setInterval(function(){var f;f=0<a.buffered.length&&10<a.buffered.end(0);0<b.buffered.length&&2<b.buffered.end(0)&&!c&&(b.volume=0.55,b.play(),c=!0);if(f)return clearInterval(e),y()},100)},playClearSound:function(){if(!p())return"function"===typeof w?w():void 0},playDrawSound:function(){if(!p())return"function"=== typeof x?x():void 0},stopDrawSound:function(){if(!p())return"function"===typeof u?u():void 0},modulateDrawSound:function(a){return"function"===typeof A?A(a):void 0},blip:function(a){if(!p())return null!=e?e.trigger(a):void 0},bloop:function(a){if(!p())return null!=f?f.trigger(a):void 0}}};var A,I;I=function(){return(new Date).getTime()/1E3};A=0;this.refreshCarbonAd=function(){var a;a=I();30<a-A&&(A=a)};$(function(){var a,b,c,e,f,g,h;h=new Silks("#silk-1","#silk-2","#sparks");a=initAudio();b=initControls(h, a);f=document.location.href.indexOf("?");-1<f?(g=document.location.href.indexOf("&"),e=document.location.href.substring(f+1),-1<g&&(e=e.substring(0,g-f-1)),d("Loading silk",e),h.load(e)):refreshCarbonAd();c=function(){b.exist();h.exist();a.modulateDrawSound(b.vmouse());return requestAnimFrame(c)};c();return ko.applyBindings(b.ui,$("#body")[0])})}).call(this);
Stammt von http://new.weavesilk.com/
Gruß,
UEZ -
Ich glaube du hast vergessen das als Code zu markieren.
-
Macht's auch nicht übersichtlicher.
Gruß,
UEZ -
dafür gibts JavaScript Beautifier
hier der Code in etwas schöner/übersichtlicher:
http://jumpshare.com/v/SVQQ7s?b=77ZyNd -
jNizM: danke für den Link - sehr praktisch, da ich sehr viele JS Source Codes habe, die total unübersichtlich sind!
Gruß,
UEZ -
Zitat
sehr praktisch, da ich sehr viele JS Source Codes habe, die total unübersichtlich sind
uhhhh, jetzt können wir uns auf etwas gefasst machen....
Btw, du hättest auch gleich den Link zu der 1024Byte-JS-Seite posten können -