randomized linspace a bit

This commit is contained in:
2017-03-18 16:57:37 +01:00
parent 184d20fcca
commit 6e557f09f8
3 changed files with 13 additions and 6 deletions

View File

@@ -3,7 +3,7 @@
(setf *random-state* (make-random-state t))
(defvar *file* "死ぬ.png")
(defvar *file* "shinu.png")
(defvar *size* (+ 500 (random 2000)))
(defmacro rand () `(random 1.0))
@@ -11,6 +11,12 @@
(defun rand-rgba (opacity)
(list (rand) (rand) (rand) opacity))
(defun randomized-linspace (begin end stp)
(let ((rnd (round (* 0.1 stp))))
(map 'list
(lambda (x) (+ x (- (random (* 2 rnd)) rnd)))
(linspace begin end stp))))
(defun main ()
(let* ((mid (* *size* .5))
(repeat (random 10))
@@ -20,7 +26,7 @@
(bg (rand-rgba 1.0))
(active (rand-rgba 0.6))
(sand (sandpaint* *size* :active active :bg bg)))
(loop for i in (linspace 100 (- *size* 100) repeat)
(loop for i in (randomized-linspace 100 (- *size* 100) repeat)
for j from offset to (+ offset repeat) do
(let ((snk (snek*))
(va (list 0 0))
@@ -45,4 +51,5 @@
(sandpaint-save sand *file*)))
(main)

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
import twitter
import config
@@ -7,4 +6,4 @@ api = twitter.Api(consumer_key=config.consumer_key,
access_token_key=config.access_token_key,
access_token_secret=config.access_token_secret)
api.PostUpdate("", media=u"死ぬ.png")
api.PostUpdate("", media="shinu.png")

View File

@@ -1,2 +1,3 @@
sbcl --script shinu.lisp
python tweet.py
/usr/local/bin/sbcl --script shinu.lisp
/usr/local/bin/python3 tweet.py
mv shinu.png out/`date +"%T"`.png