annotate generateIcon.R @ 271:846df0ea9c82 v0.5

Version
author Chris Cannam <chris.cannam@eecs.qmul.ac.uk>
date Thu, 03 Apr 2014 09:39:16 +0100
parents 91cc6e6a4db3
children
rev   line source
matthiasm@75 1 t <- seq(0,8*pi,.01)
matthiasm@76 2 w <- pnorm(t, 4*pi, .7)
matthiasm@75 3 n <- length(t)
matthiasm@75 4 pitchDiff <- 6
matthiasm@75 5 sin1 <- sin(t) + pitchDiff
matthiasm@75 6 sin2 <- sin(t)
matthiasm@81 7 x <- sin1 * w + sin2 * (1-w)
matthiasm@75 8
matthiasm@79 9 pad <- 3
matthiasm@75 10
matthiasm@86 11 for (sz in c(16,22,24,32,48,64,128)) {
matthiasm@86 12 lineWidth <- 15 * sz/200
matthiasm@86 13 outlineWidth <- 20 * sz/200
matthiasm@86 14 png(sprintf("~/code/tonioni/icons/tony-%ix%i.png",sz,sz), width = sz, height = sz, bg="transparent")
matthiasm@86 15 par(mar=c(0,0,0,0))
matthiasm@86 16 plot(t, x, type='l',
matthiasm@86 17 lwd=lineWidth*3, bty='n', xaxt='n', yaxt='n',
matthiasm@86 18 ylim = c(-pad, pitchDiff+pad) + c(1,-1)*0.1,
matthiasm@86 19 xlim = c(0, 8*pi) + c(1,-1)*0.1,
matthiasm@86 20 col="white")
matthiasm@86 21 lines(t, x,
matthiasm@86 22 lwd=lineWidth, col = "black")
matthiasm@86 23 lines(c(0,0),c(-pad,pitchDiff+pad), lwd=outlineWidth, col = 'blue', lend=2)
matthiasm@86 24 lines(c(0,0)+8*pi,c(-pad,pitchDiff+pad), lwd=outlineWidth, col = 'blue', lend=2)
matthiasm@86 25 lines(c(0,8*pi),c(0,0)+pitchDiff+pad, lwd=outlineWidth, col = 'blue', lend=2)
matthiasm@86 26 lines(c(0,8*pi),c(0,0)-pad, lwd=outlineWidth, col = 'blue', lend=2)
matthiasm@86 27 dev.off()
matthiasm@86 28 }
matthiasm@86 29