Yin and yang: Difference between revisions
→{{header|Locomotive Basic}}: add screenshot
m (→SVG (path evenodd): refactoring) |
(→{{header|Locomotive Basic}}: add screenshot) |
||
(10 intermediate revisions by 3 users not shown) | |||
Line 1,085:
==={{header|Locomotive Basic}}===
[[File:Cpcbasic yin yang.png|thumb|Output]]
<syntaxhighlight lang="locobasic">10 mode 2:deg:defint a-z:ink 0,26:ink 1,0:border 26
20 xp=320:yp=200:size=150:gosub 100
Line 1,995:
### </pre>
=={{header|EasyLang}}==
[https://easylang.dev/show/#cod=VY/dCsIwDEbv8xTftbIapx30cWYso1jXEVHs20t13SbkIj8nJ2TSJJCgAoXAwBAASTEp5JsGleihZGgqaA5j7scBb2Ro5e/p5UunLqDFDgpmXm3OuTp++GEmHKNxvFWggS6aVfGrDjhVz8Lv//jNlZkvBkOXXm6Dpud4hbWWJPpeqf7ScoluqS2jYxzP9AE= Run it]
<syntaxhighlight>
proc circ r c . .
color c
circle r
.
proc yinyang x y r . .
move x y
circ 2 * r 000
color 999
circseg 2 * r 90 -90
move x y - r
circ r 000
circ r / 3 999
move x y + r
circ r 999
circ r / 3 000
.
background 555
clear
yinyang 20 20 6
yinyang 50 60 14
</syntaxhighlight>
{{out}}
<pre>
</pre>
=={{header|Evaldraw}}==
Line 2,150 ⟶ 2,180:
[[File:YinYang-flutter.png]]<br>
[https://dartpad.dev/?id=c54bafac1d8f46c07db626dca64e13e4 Watch/play online DartPad]
<syntaxhighlight lang="dart">import 'dart:math' show pi;
import 'package:flutter/material.dart';
Line 2,165 ⟶ 2,195:
}
void main() => runApp(
class YinYangPainter extends CustomPainter {
Line 2,186 ⟶ 2,210:
bool shouldRepaint(CustomPainter oldDelegate) => true;
}
</syntaxhighlight>
===Flutter (without CustomPaint)===
[https://dartpad.dev/?id=e0502d089330620c9866ef5fc2310042 Run online in DartPad]
<syntaxhighlight lang="dart">import 'package:flutter/material.dart';
const color = [Colors.black, Colors.white];
Widget cR(int iColor, double r, {Widget? child}) => DecoratedBox(
decoration: BoxDecoration(color: color[iColor], shape: BoxShape.circle),
child: SizedBox.square(dimension: r * 2, child: Center(child: child)));
Widget yinYang(double r, [double th = 1.0]) => Padding(
padding: const EdgeInsets.all(5),
child: ClipOval(
child: cR(0, r + th,
child: cR(1, r,
child: Stack(alignment: Alignment.center, children: [
Container(color: color[0], margin: EdgeInsets.only(left: r)),
Column(children: List.generate(2, (i) => cR(1 - i, r / 2, child: cR(i, r / 6))))
])))));
void main() => runApp(MaterialApp(
home: ColoredBox(color: color[1], child: Wrap(children: [yinYang(50), yinYang(20)]))));
</syntaxhighlight>
Line 5,564 ⟶ 5,611:
===Text===
{{trans|AWK}}
<syntaxhighlight lang="
return (x-centerX)*(x-centerX)+(y-centerY)*(y-centerY) <= radius*radius
}
Line 5,663 ⟶ 5,710:
{{libheader|DOME}}
With a few minor changes, we can use the same code to draw these symbols in DOME.
<syntaxhighlight lang="
import "graphics" for Canvas, Color
|