Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
35
Task/Animation/Julia/animation-1.julia
Normal file
35
Task/Animation/Julia/animation-1.julia
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
using Tk
|
||||
|
||||
const frameinterval = 0.12 # partial seconds between change on screen display
|
||||
|
||||
function windowanim(stepinterval::Float64)
|
||||
wind = Window("Animation", 300, 100)
|
||||
frm = Frame(wind)
|
||||
hello = "Hello World! "
|
||||
but = Button(frm, width=30, text=hello)
|
||||
rightward = true
|
||||
callback(s) = (rightward = !rightward)
|
||||
bind(but, "command", callback)
|
||||
pack(frm, expand=true, fill = "both")
|
||||
pack(but, expand=true, fill = "both")
|
||||
permut = [hello[i:end] * hello[1:i-1] for i in length(hello)+1:-1:2]
|
||||
ppos = 1
|
||||
pmod = length(permut)
|
||||
while true
|
||||
but[:text] = permut[ppos]
|
||||
sleep(stepinterval)
|
||||
if rightward
|
||||
ppos += 1
|
||||
if ppos > pmod
|
||||
ppos = 1
|
||||
end
|
||||
else
|
||||
ppos -= 1
|
||||
if ppos < 1
|
||||
ppos = pmod
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
windowanim(frameinterval)
|
||||
35
Task/Animation/Julia/animation-2.julia
Normal file
35
Task/Animation/Julia/animation-2.julia
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
using Gtk.ShortNames
|
||||
|
||||
const frameinterval = 0.12 # partial seconds between change on screen display
|
||||
|
||||
function textanimation(stepinterval::Float64)
|
||||
hello = "Hello World! "
|
||||
win = Window("Animation", 210, 40) |> (Frame() |> (but = Button("Switch Directions")))
|
||||
rightward = true
|
||||
switchdirections(s) = (rightward = !rightward)
|
||||
signal_connect(switchdirections, but, "clicked")
|
||||
permut = [hello[i:end] * hello[1:i-1] for i in length(hello)+1:-1:2]
|
||||
ppos = 1
|
||||
pmod = length(permut)
|
||||
nobreak = true
|
||||
endit(w) = (nobreak = false)
|
||||
signal_connect(endit, win, :destroy)
|
||||
showall(win)
|
||||
while nobreak
|
||||
setproperty!(but, :label, permut[ppos])
|
||||
sleep(stepinterval)
|
||||
if rightward
|
||||
ppos += 1
|
||||
if(ppos > pmod)
|
||||
ppos = 1
|
||||
end
|
||||
else
|
||||
ppos -= 1
|
||||
if(ppos < 1)
|
||||
ppos = pmod
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
textanimation(frameinterval)
|
||||
Loading…
Add table
Add a link
Reference in a new issue