Исправление i-rinat, (текущая версия) :
import struct
import math
import random
width = 1376
height = 768
fb = open('/dev/fb0', 'wb')
def putpixel(x,y,c):
ofs = 4*(width*y + x)
fb.seek(ofs)
fb.write(struct.pack("<BBB", c[0], c[1], c[2]))
xb = random.randrange(3, 15)
yb = random.randrange(3, 15)
xc = random.randrange(0, 1000) / 1000.0 * math.pi * 2
yc = random.randrange(0, 1000) / 1000.0 * math.pi * 2
for t in range(10000):
x = 350 * math.sin(2 * math.pi * t / 10000 * xb + xc)
y = 350 * math.sin(2 * math.pi * t / 10000 * yb + yc)
putpixel(int(1376/2 + x), int(768/2 + y), (255,255,255))
Так достаточно ясно?
Исходная версия i-rinat, :
import struct
import math
import random
width = 1376
height = 768
fb = open('/dev/fb0', 'wb')
def putpixel(x,y,c):
ofs = 4*(width*y + x)
fb.seek(ofs)
fb.write(struct.pack("<BBB", c[0], c[1], c[2]))
xb = random.randrange(3, 15)
yb = random.randrange(3, 15)
xc = random.randrange(0, 1000) / 1000.0 * math.pi * 2
yc = random.randrange(0, 1000) / 1000.0 * math.pi * 2
for t in range(10000):
x = 350 * math.sin(2 * math.pi * t / 10000 * xb + xc)
y = 350 * math.sin(2 * math.pi * t / 10000 * yb + yc)
putpixel(int(1376/2 + x), int(768/2 + y), (255,255,255))