This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* see https://seriot.ch/projects/programming_in_postscript.html#2 */ | |
/* Comments */ | |
/* | |
comment.block | |
comment.block.documentation.tag | |
comment.line | |
comment.line.double-dash | |
comment.line.double-slash | |
comment.line.number-sign |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%!PS | |
%%Title: cpc2.ps | |
%%Creator: Nicolas Seriot | |
% January 2025 | |
% Amstrad CPC Color Palette | |
% https://www.cpcwiki.eu/index.php/CPC_Palette | |
% https://seriot.ch/projects/drawing_with_computers.html | |
% https://bsky.app/profile/nst021.bsky.social/post/3leytevn6ck25 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%!PS | |
%%Title: cpc.ps | |
%%Creator: Nicolas Seriot | |
% January 2025 | |
% Amstrad CPC Color Palette | |
% https://www.cpcwiki.eu/index.php/CPC_Palette | |
% https://seriot.ch/projects/drawing_with_computers.html | |
% https://bsky.app/profile/nst021.bsky.social/post/3leytevn6ck25 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%!PS | |
%%BoundingBox: 0 0 320 240 | |
% gv -infoSilent anim.ps | |
/Courier findfont 12 scalefont setfont | |
/sleep { 100000 mul {} repeat } def | |
/x 100 def |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
pygame.init() | |
# 1 = en haut à droite | |
# 2 = en bas à droite | |
# 3 = en bas à gauche | |
# 4 = en haut à gauche | |
l_écran = 400 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame as p | |
import random | |
R,r,W,H,G,N=range,random.randrange,480,320,3,5 | |
g=[[r(W),r(H),r(W),r(H)]+[r(-9,9,2)for _ in R(4)] for _ in R(G)] | |
p.init() | |
s=p.display.set_mode((W,H)) | |
f=lambda n,d,L:(n+(d:=d*(-1 if n+d not in R(L)else 1)),d) | |
while 1: | |
s.fill([0]*3) | |
for i,l in enumerate(g): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const canvas = document.getElementById('lines'); | |
const ctx = canvas.getContext('2d'); | |
const W = canvas.width; | |
const H = canvas.height; | |
const G = 4, N = 6; | |
const rand = (max, step = 1) => Math.floor(Math.random() * max / step) * step; | |
const next = (line, vel) => line.map((p, i) => (vel[i] *= (p + vel[i] >= 0 && p + vel[i] < (i % 2 ? H : W)) ? 1 : -1, p + vel[i])); | |
const drawLines = (lines, ctx) => lines.forEach(l => ctx.stroke(new Path2D(`M ${l[0]} ${l[1]} L ${l[2]} ${l[3]}`))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame as p | |
import random as m | |
R=range | |
r=m.randrange | |
S=(480,320) | |
def n(l,v): | |
for i in R(4): | |
v[i]*=-1+2*(l[i]+v[i]in R(S[i%2])) | |
return[l[i]+v[i]for i in R(4)] | |
V=[[r(-9,9,2)]*4for _ in R(5)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame as pg | |
import random as r | |
W, H = 800, 600 | |
G, L = 4, 6 | |
def next(l, v): | |
for i in range(4): | |
v[i] *= 1 if l[i] + v[i] in range(W if i % 2 == 0 else H) else -1 | |
return [l[i] + v[i] for i in range(4)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
import random | |
WIDTH = 800 | |
HEIGHT = 600 | |
NB_GROUPS = 5 | |
HISTO_SIZE = 8 | |
LINE_COLOR = (255,255,255) | |
BKG_COLOR = (0,0,0) |
NewerOlder