Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Animate
- // Draw in white on a black background, rotate globally with the mouse
- background_color "black"
- color "white"
- rotate_x -180 * mouse_y / window_height
- rotate_y 180 * mouse_x / window_width
- // Font and text alignment
- font "Arial", 300
- align 0.5
- align_vertically 0.5
- // The size of the boxes used to show each digit
- once
- H := 1.1 * text_height "0"
- W := 1.1 * text_width "0"
- // The primary draw loop
- locally
- Index := 0
- translate_x -2.5*W
- two_digits with hours, minutes, seconds
- // Overlay to highlight the current time
- blend_function "DST_COLOR", "ONE_MINUS_SRC_ALPHA"
- color_hsv 2 * time, 0.3, 0.5, 0.7
- rectangle 0, 0, 6.5*W, H
- // Drawing two digits
- two_digits N:integer -> digit_column with N/10, N mod 10
- // Drawing a single digit column
- digit_column N:integer ->
- locally
- adjust -N*H, currentY[Index]
- digit with 0..9
- // Move to the next one
- translate_x W
- Index := Index+1
- // Drawing a single digit in a text box
- digit N:integer ->
- text_box 0,0,2*W,2*H,
- render N
- translate_y H
- // Vertical adjustment - Common case
- adjust TY:real, Y:real ->
- interpolate 0.1, TY, Y
- translate_y Y
- // Vertical adjustment - Initialization case
- adjust TY:real, Other ->
- currentY[Index] := TY
- adjust TY, currentY[Index}
- // The variables we use
- H -> 15.0
- W -> 15.0
- Index -> 0
- data currentY
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement