예제 #1
0
파일: code.py 프로젝트: adutoi/PyToon
from pytoon import composite, line, circle

sub_image = composite([
    line(begin=(-150, 0), end=(+150, 0), lstyle=("WEIGHT", "#A0522D")),
    circle(center=(-30, 0), radius=100, lstyle=False, fstyle="salmon"),
    circle(center=(+30, 0), radius=100, lstyle=False, fstyle="GREEN")
])

image = composite([
    sub_image(GREEN="0.1*green"),
    sub_image(GREEN="0.2*green").T(0, 110),
    sub_image(GREEN="0.3*green").T(0, 220),
    sub_image(GREEN="0.4*green").T(300, 0),
    sub_image(GREEN="0.5*green").T(300, 110),
    sub_image(GREEN="0.6*green").T(300, 220),
    sub_image(GREEN="0.7*green").T(600, 0),
    sub_image(GREEN="0.8*green").T(600, 110),
    sub_image(GREEN="0.9*green").T(600, "Two20")
],
                  WEIGHT=30,
                  Two20=220).R(20)

image.svg()
예제 #2
0
from pytoon import composite, line, circle

composite([
    line(begin=(-150, 0), end=(+150, 0), lstyle=(3, "#A0522D")),
    circle(center=(-30, 0), radius=100, lstyle=False, fstyle="salmon"),
    circle(center=(+30, 0), radius=100, lstyle=False, fstyle="0.8 * green")
]).svg("two-circles")
예제 #3
0
파일: code.py 프로젝트: adutoi/PyToon

X, Y, d = 600, 200, 15

Nx, Ny = int_round(X / d), int_round(Y / d)
Px, Py = [i * X / Nx
          for i in range(Nx + 1)], [i * Y / Ny for i in range(Ny + 1)]

positions = []
for x in Px:
    for y in Py:
        positions += [(x + rand() * d, y + rand() * d)]
special = ((Nx + 1) * (Ny + 1)) // 2 - (Ny + 1) // 4 - 1

block = polygon(lstyle=False, fstyle="#202020")
molecule = circle(radius=4, lstyle=("black", 0.25), fstyle="#3bba9c")
molecules = [molecule(center=(x, y)) for x, y in positions]
surface = [(i * X / 125, Y * 1.05) for i in range(125 + 1)]

wavy = [i * X / 125 for i in range(63)]
wavy = [(x, 10) for x in wavy] + [(x, -10) for x in reversed(wavy)]
wavy = polygon(points=wavy, lstyle=("black", 0.25),
               fstyle="green").S(0.40).R(60).T(0, -15)

image = composite([
    composite([
        polygon(points=[(0, -20), *surface, (X, -20)],
                lstyle=False,
                fstyle="#233142"), *molecules,
        wavy.S(1).T(60, 0),
        wavy.S(1.1).T(150, 0),
예제 #4
0
from pytoon import circle

circle().svg()
예제 #5
0
from pytoon import composite, line, circle

my_circle = circle(radius=100, lstyle=False, fstyle="salmon")

composite([
    line(begin=(-150, 0), end=(+150, 0), lstyle=(3, "#A0522D")),
    my_circle(center=(-30, 0)),
    my_circle(center=(+30, 0), fstyle="0.8 * green")
]).svg("two-circles")
예제 #6
0
import math
from pytoon import composite, circle, polygon, animated

def c(_t_):
    x = 50 * math.cos(2*math.pi * _t_)
    return (x,0)

image = composite([
    polygon(points=[(-200,-110), (-200,110), (200,110), (200,-110)], lstyle=False, fstyle="tan"),
    circle(center=animated(c,Dt=0.05))
    ])

image.svg(time=(0,1), duration=2)