All pastes #508145 Raw Edit

Untitled

public text v1 · immutable
·published 2007-05-24 21:46 UTC
rendered paste body
menu * {
  .Picwin Clock { 
    start2
  }
}
alias start2 {
  window -opdH +dL @clock 800 80 80 80
  var %x = 0 
  while (%x <= 15) { 
    drawreplace @clock $iif(%x < 10,0 $+ %x,%x) 15
    inc %x 
  }
  drawline @clock 04 1 40 40 $x(ss,38) $y(ss,38)
  set %xs $x(ss,38)
  set %ys $y(ss,38)
  /timerclock 0 1 refresh
  drawrect -ef @clock 0 1 1 2 76 76
}
alias refresh {
  drawrect -e @clock 0 1 1 2 76 76
  drawline @clock $3 1 40 40 $calc(40 + 35 * $cos($calc($time(ss) * 6)).deg) $calc(40 + 35 * $sin($calc($time($2) * 6)).deg)
  drawline @clock $3 1 40 40 $calc(40 + 25 * $cos($calc($time(ss) * 6)).deg) $calc(40 + 25 * $sin($calc($time($2) * 6)).deg)
  drawline @clock $3 1 40 40 $calc(40 + 15 * $cos($calc($time(ss) * 6)).deg) $calc(40 + 15 * $sin($calc($time($2) * 6)).deg)
}
alias x { return $calc(40 + $1 * $cos($calc($time($2) * 6)).deg) }
alias y { return $calc(40 + $1 * $sin($calc($time($2) * 6)).deg) }
on *:APPACTIVE: {
  if (!$appactive) {
    if ($window(@clock)) {
      window -c @clock
      set %appactive2 on
    }
  }
  else {
    if (%appactive2 == on) {
      start2
    }
  }
}
on *:KEYDOWN:@clock:*: {
  if ($keyval == 40) { window -s @clock $window(@clock).x $calc($window(@clock).y + 2) }
  elseif ($keyval == 39) { window -s @clock $calc($window(@clock).x + 2) $window(@clock).y }
  elseif ($keyval == 38) { window -s @clock $window(@clock).x $calc($window(@clock).y - 2) }
  elseif ($keyval == 37) { window -s @clock $calc($window(@clock).x - 2) $window(@clock).y }
}
on *:CLOSE:@clock: {
  .timerclock off
  set %appactive2 off
}


_-={20:31:55}=-_ <jaytea> let the center be (X, Y), let the length of the line be N, the other co-ordinate 
is $calc(X + N * $cos($calc($time(nn) * 6)).deg) , $calc(Y + N * $sin($calc($time(nn) * 6)).deg)