lambdaway
::
cyclics
7
|
list
|
login
|
load
|
|
{div {@ id="cyclic"}} {draw_cyclic 2 4} {{hide} {def draw_cyclic {lambda {:a :b} {{SVG 580} {g {AXES 580 580} {polyline {@ points="{S.map {cyclic :a :b} {S.serie -10 10 0.01}}" {stroke #fff 4}}}}} {center {b p(t) = e{sup it} + {sup 1}/{sub 2}e{sup A*it} + {sup i}/{sub 3}e{sup B*it}, where A = :a & B = :b}} }} {def cyclic {lambda {:a :b :t} {* 150 {+ {cos :t} {* {/ 1 2} {cos {* :a :t}}} {* {/ 1 -3} {sin {* -:b :t}}}}} {* 150 {+ {sin :t} {* {/ 1 2} {sin {* :a :t}}} {* {/ 1 3} {cos {* -:b :t}}}}} }} {def SVG {lambda {:h} svg {@ width="580px" height=":hpx" style="background:#444"} }} {def AXES {lambda {:w :h} {@ transform="translate({/ :w 2},{/ :h 2}) scale(1,-1)"} {line {@ x1="-{/ :w 2}:w" y1="0" x2="{/ :w 2}" y2="0" stroke="red" fill="transparent"}} {line {@ x1="0" y1="-{/ :h 2}" x2="0" y2="{/ :h 2}" stroke="green" fill="transparent"}} }} {def stroke {lambda {:col :w} stroke=":col" fill="transparent" stroke-width=":w" }} } {script var foo = function() { document.getElementById("cyclic").innerHTML = LAMBDATALK.eval_forms( "{draw_cyclic {floor {* 10 {random}}} {floor {* 5 {random}}}}") }; setTimeout( foo, 1 ) setInterval( foo, 2000 ) }
lambdaway v.20211111