#!/bin/sh #################################### # spoxbrane - algorithmic art script # version 1.0 by geekmaster #################################### #=================================== # spoxbrane - eink moire pattern art #----------------------------------- spoxbrane() { local i j r eips -c -f # flash clear eips 19 18 "Spoxbrane 1.0" sleep 2 eips 19 20 "by Geekmaster" sleep 4 eips -c -f # flash clear i=100; while [[ $i -gt 0 ]];do i=$((i-1)); j=$((150-i)); r=$((i*2+1)) line $((i*4)) 0 599 $((i*16/3)) circle 335 400 $r line 599 $((i*16/3)) $((j*4)) 799 circle 300 490 $r line $((j*4)) 799 0 $((j*16/3)) circle 265 400 $r line 0 $((j*16/3)) $((i*4)) 0 circle 300 310 $r done } #=========================== # initvar - init global vars #--------------------------- initvar() { local i DZ=/dev/zero DN=/dev/null DI=/dev/input DF=/dev/fb0 T=$(for i in $DI/event*;do evtest info $i|grep zforce>$DN && echo $i;done) set $(eips -i|grep line_length); VX=$4 } #================================== # line - Bresenham's line algorithm # usage: line x0 y0 x1 y1 #---------------------------------- line() { local x0=$1 y0=$2 x1=$3 y1=$4 local dx dy sx sy if [[ $x1 -gt $x0 ]];then dx=$((x1-x0));sx=1; else dx=$((x0-x1));sx=-1;fi if [[ $y1 -gt $y0 ]];then ny=$((y0-y1));sy=1; else ny=$((y1-y0));sy=-1;fi e=$((dx+ny)) while [[ $x0 -ne $x1 || $y0 -ne $y1 ]];do dd if=$DZ of=$DF bs=1 count=1 seek=$((y0*VX+x0)) 2>$DN e2=$((e+e)) if [[ $e2 -gt $ny ]];then e=$((e+ny));x0=$((x0+sx));fi if [[ $e2 -lt $dx ]];then e=$((e+dx));y0=$((y0+sy));fi done dd if=$DZ of=$DF bs=1 count=1 seek=$((y0*VX+x0)) 2>$DN eips '' # update display } #=================================== # circle - midpoint circle algorithm # usage: circle cx cy r #----------------------------------- circle() { local cx=$1 cy=$2 r=$3 local e=$((-r)) x=$r y=0 while [[ $x -ge $y ]];do dd if=$DZ of=$DF bs=1 count=1 seek=$(((cy+y)*VX+cx+x)) dd if=$DZ of=$DF bs=1 count=1 seek=$(((cy+y)*VX+cx-x)) dd if=$DZ of=$DF bs=1 count=1 seek=$(((cy-y)*VX+cx+x)) dd if=$DZ of=$DF bs=1 count=1 seek=$(((cy-y)*VX+cx-x)) dd if=$DZ of=$DF bs=1 count=1 seek=$(((cy+x)*VX+cx+y)) dd if=$DZ of=$DF bs=1 count=1 seek=$(((cy+x)*VX+cx-y)) dd if=$DZ of=$DF bs=1 count=1 seek=$(((cy-x)*VX+cx+y)) dd if=$DZ of=$DF bs=1 count=1 seek=$(((cy-x)*VX+cx-y)) e=$((e+y)); y=$((y+1)); e=$((e+y)) if [[ $e -ge 0 ]];then e=$((e-x));x=$((x-1));e=$((e-x));fi done 2>$DN eips '' # update display } lipc-set-prop com.lab126.powerd preventScreenSaver 1 initvar # init global vars spoxbrane # eink moire pattern art dd if=/dev/fb0 of=/mnt/us/spoxbrane.raw lipc-set-prop com.lab126.powerd preventScreenSaver 0