Forum > Graphics
Random SnowFlakes:
Boleeman:
Hi All.
I have found a nice random Javascript snowflake generator that uses svg elements to generate random snowflake curves.
It is in a html file and is only one line long.
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---<canvas id=b><svg onload='with(Math)for(I=Y=0;Y++<70;I=random()-1.9&I+1)for(i=12;i--;C=X=>b.getContext`2d`.fillRect(70+X,s*j+c*Y+70,1,1)||X,C(-C((c=cos(a=PI/3*i))*j-(s=sin(a))*Y)))j=i>5&&I'>
I tried to convert to Lazarus using a TBgrabmp, but all I see is dots.
Is it possible to use svg in TBgrabmp to draw the random snowflakes correctly?
Can't seem to work out how to render the curve correctly so that it looks like a snowflake.
Must have something to do with the svg graphics ?
Boleeman:
Somehow need to work out how to render svg in Lazarus ?
Dzandaa:
Hi
@Boleeman:
In BGRAControls, there is a TBCSVGViewer
Create your SVG code in a string and put it in TBCSVGViewer.SVGString
B->
Roland57:
Hi. I don't know the answer to your question, but here are my snowflakes using Cairo. :)
https://forum.lazarus.freepascal.org/index.php/topic,57657.msg428979.html#msg428979
Boleeman:
Sorry about the late reply: Been a bit crook lately with a bug.
Thanks Dzandaa and Roland57 for your replies about snowflakes.
Roland57: Compiled your Cairo Snowflake Lazarus source after downloading GTK from
http://downloads.sourceforge.net/gladewin32/gtk-2.12.9-win32-2.exe
I tried installing GTK3 runtime but was getting an error after compiling the Cairo snowflake code..
Also remembered seeing a few interesting cpp and CSharp snowflake examples on Codeproject ages ago.
Went to the Codeproject site yesterday and it looks like it has gone by way of the DODO .... Shutdown.
I compiled a CSharp Xmas Snowflakes code, but the flakes seem quite ordinary.
There was another Codeproject example that had some intricate random snowflakes but I can't find where I put it.
Navigation
[0] Message Index
[#] Next page