for y in range(6): with Move(x,y),Scale((1/12,1/12)): sisu(x,y,t,*args) def loop(t): with Scale((2.5,2.5)),Move(-4,-3): colors=[HSVA(0,0.4,0.7),HSVA(0.17,0.5,0.9),HSVA(0.17,0.5,0.56),HSVA(0.1,0.5)] if int(t)%2==0: colors=[HSVA(0,1,0.9),HSVA(0.17,1,0.9),HSVA(0.7,1,0.8),HSVA(0.1,1)] for d,c in zip(range(4),colors): ruudu(t,seitse,d) fill(c) ruudu(t,kaheksa) fill(HSVA(0,0.9,0.3)) im=ImagePattern(image,300) paint(im,0.2) for d,c in zip(range(4),colors): ruudu(t,seitse,d) ruudu(t,kaheksa) n=0.56 stroke(0.02,RGBA(n,n,n)) paint(im,0.3) animate(loop,camera=Camera((16,9),120),duration=5)
leaves = [] def tree(count, t): if count == 0: leaves.append(Point(0, 0)) return line((0, 0), (0, 1)) stroke(0.2, HSVA(0, 0, 0)) for d, w, n in [(-35, 0.4, 1), (0, 0.7, 1), (20, 0.5, 1)]: if True: d += t * 10 / count**2 with Move(0, n), Rotate(d), Scale((w, 1.3 * w)): tree(count - 1, t) def loop(t): with Move(0, -5.5), Scale((2, 2)): global k, r, leaves leaves = [] seed(6736) tree(7, 5 * sin(t * 5)) for l in leaves: circle(tuple(l), 0.1 * t / 6) fill(HSVA(0, 0, 0)) animate(loop, duration=8)
import wisualia from wisualia.do import fill from wisualia.shapes import circle from wisualia.modifiers import Rotate, Move from wisualia.patterns import HSVA from wisualia.animation import animate, Camera from math import sin, pi def loop_function(t): for i in range(36): with Rotate(i * 10): with Move(-(i % 6) * sin(t), 0): circle((5, 0), 0.5) fill(HSVA(i / 36 + t)) animate(loop_function, camera=Camera((20, 20), 40))
p.draw() stroke(pattern=RGBA(0, 0, 0), width=0.05) def loop(t): paint(RGBA(0, 0, 0)) g = LinearGradient((0, -2), (0, 2), [(0, RGBA(1, 0, 0)), (1, (RGBA(0, 0, 1)))]) if t > 9: g = RGBA(1, 1, 1, abs(9.2 - t) * 10) if t > 9.2: explain() t = 9.2 random.seed(t) text((-5.8, -1), 'Wisualia', 3) (a, b), (c, d) = fill_extents() buf = [] nr = int(t * 150) for _ in range(nr): x = random.uniform(a, c) y = random.uniform(b, d) if in_fill(x, y): buf.append((x, y)) fill(RGBA(0, 0, 0, 0)) draw_buf(buf, g) print('Wisualia, t=' + str(t)) animate(loop, Camera((16, 8), 40))
with Move(2, 1): p = Point(1, 1) a, b = p rect(p, p) print(p[0]) print(p) with Clip(): circle((0.5, 0), t) with Clip(): #fill() paint(RGBA(1, 0, 0)) #fill() #circle((0,1),1) #stroke() #with Move(2,0): ip = ImagePattern(image, 40) g = LinearGradient((0, 0), (3, 3), [(0, RGBA(1, 0, 0, 0)), (1, RGBA(1, 0, 0))]) mask(ip, g) p = Pencil() p.line(1, 1) p.line(2, 1) p.draw() stroke() animate(loop, duration=3)
from wisualia.do import fill, stroke from wisualia.shapes import circle from wisualia.patterns import RGBA, ImagePattern, LinearGradient, RadialGradient from wisualia.pencil import Pencil from wisualia.image import Image from wisualia.animation import animate im = Image.from_png('example.png') def loop(t): p1 = (0, 0) p2 = (0, 0) p3 = (-t, 3) p4 = (3, 3) p = Pencil() p.move(*p1) p.curve(p3, p3, p4) circle(p2, 0.1) circle(p3, 0.1) fill(RGBA(1, 0, 0)) p.line(-5, -5) p.line(-6, -6) p.line(-3, 0) p.draw() stroke(0.1, RGBA(0, 1, 0)) animate(loop)
pattern.set_corner_color_rgb(1, 0, 1, 0) pattern.set_corner_color_rgb(2, 0, 0, 1) pattern.set_corner_color_rgb(3, 1, 1, 0) pattern.end_patch() # Add a Gouraud-shaded triangle pattern = cairo.MeshPattern() pattern.begin_patch() pattern.move_to(100, 100) pattern.line_to(130, 130) pattern.line_to(130, 70) pattern.set_corner_color_rgb(0, 1, 0, 0) pattern.set_corner_color_rgb(1, 0, 1, 0) pattern.set_corner_color_rgb(2, 0, 0, 1) pattern.end_patch() cr.set_source(pattern) cr.paint() USE_ZOOM = True def loop(t): cr = cairo.Context(core.image.surf) if USE_ZOOM: cr.set_matrix(core.context.get_matrix()) cairo_loop(t, cr) animation.animate(loop, animation.Camera((30, 30), 40))