{deck}
version:1
card:0
size:[512,342]
name:"Public Transit"
author:"IJ and Noyemi"

{card:Listing}
image:"%%[encoded data, 193884 characters]"
script:"Listing.0"
{widgets}
options:{"type":"grid","size":[111,298],"pos":[12,29],"script":"Listing.1","font":"menu","show":"invert","scrollbar":0,"headers":0,"lines":0,"value":{"value":["Dissolve","BlindsVert","BlindsHoriz","StarIn","StarOut","StarSpinIn","StarSpinOut","HeartIn","HeartOut","CircleIn","CircleOut","CircleInClick","CircleOutClick","StretchDown","StretchUp","StretchRight","StretchLeft","Wink"]},"row":5}
descript:{"type":"field","size":[170,25],"pos":[325,148],"style":"plain","value":"Spinning star-shaped zoom-in."}
button1:{"type":"button","size":[82,24],"pos":[325,177],"script":"Listing.2","text":"Preview","style":"rect"}
button2:{"type":"button","size":[83,24],"pos":[412,177],"script":"Listing.3","text":"Fullscreen","style":"rect"}
preview:{"type":"canvas","size":[170,114],"pos":[325,30],"image":"%%IMG0AKoAcgAAAAAAAAAAAAAAAAAAAAAAAAAAEUAAAAAAAAAAAAAAAAAAAAAAAAAAABVAAAAAAAAAAAAAAAAAAAAAAAAAAABVQAAAAAAAAAAAAAAAAAAAAAAAAAAAFEAAAAAAAAAAAAAAAAAAAAAAAAAAABVAAAAAAAAAAAAAAAAAAAAAAAAAAABUQAAAAAAAAAAAAAAAAAAAAAAAAAAfVUAAAAAAAAAAAAAAAAAAAAAAAAAAP1UAAAAAAAAAAAAAAAAAAAAAAAAAAF9VQAAAAAAAAAAAAAAAAAAAAAAAAAAfVQAAAAAAAAAAAAAAAAAAAAAAAAAAH0FAAAAAAAAAAAAAAAAAAAAAAAAAAB8RQAAAAAAAAAAAAAAAAAAAAAAAAABfUUAAAAAAAAAAAAAAAAAAAAAAAAAAX1FAAAAAAAAAAAAAAAAAAAAAAAAAAF9UQAAAAAAAAAAAAAAAAAAAAAAAAAFfVQAAAAAAAAAAAAAAAAAAAAAAAAABH1VAAAAAAAAAAAAAAAAAAAAAAAAAAV8FQAAAAAAAAAAAA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AAAAD/8AAAAAB/////wEAAAAAAAAAAAAAAqqAAAAAAf////8DaqqqqABcAAAAAAP/wAAAAAH/////AUAAAAAEBAAAAAACqoAAAAAA/////wOqqqqoBdwAAAAAA//AAAAAAf////8BQAAAAAd0AAAAAACqgAAAAAP//7u7A+qqqqgAxAAAAAAA//4AAAAP/////wFIiIiIiHcAAAAAAKqqqqqq7u7v//8D4AhAOA/dAAAAAALv/5JJN///////A0iIiIiJdoB3d3dgqqiCGAO5/////wPhbBAGAZwAABAAAu/xEkAH//////8ByP4CQQGMf574H+DhxgIQP/7/////A////////////////////////////wF3d3d3d3d3d3d3e7u7u7u7u/////8C////////////////////////////Af/////////////////////+/////wL///////////////////////////8Bd3d3d3d3d3d3d3u7u7u7u7v/////Av///////////////////////////wH////////QD/wF/A////////////8C////////wAfwA/AH////////////AX///////wAD4APwA//////7/////wL///////8AA8AB4AH///////////8B////////AAHAAcAA/////+//////Av///////wABwAHwAf///////////wF///////8AAcAB4AG///////////8C////////IAHAAeAB////////////Af///////wABwAHAAO///////////wL///////8AA8AD8AH///////////8Bf///////AAHAAeAB//////v/////Av///////yAh4CHhAf///////////wH///////8AAcAB4ADv//////////8C////////AgPCA/AR////////////AX///////wABwAHAAT6qrUAX/////wLv7v6q//8gIaAh4QH/////V/////8BVd3d3c3dAAAgAGAAru7u7uh/////Av//vv///wIDwgPwEfX////93////wF3dHF3dAAAAUABQAK4Oyq7urd///8C/+uq/vquoCf6I/lffVX////9V///AUFVVUFAAABRUBVIAKqqqqru7u3//wKq/+qq//qqv/ur////////////H/8BVVVVVVAABVVVVUAAqqqqqru7u9v/A////////+v////9///////////3/wFVVVVVVVVVVVQVSqqqqqqqquru7f8D//////////////////////////9/AVVVVVVVVVVVVVVKqqqqqqqqq7u7VQP///////////////////////////UBVVVVVVVVVVVVVUqqqqgAAAKqrq7uA//////////////////8EBAT/////wFUAAAAAAAAAAAAAAAAAAAAACqru7sAICAgICAgICAgICEBAQEBAQE/////AAAAAAAAAAAAAAAAAAAAAAAAAqru7gICAgICAgICAgICEBAQEBAQEBP///8AAAAAAAAAAAAAAAAAAAAAAAAACru7ACAgICAgICAgICAhAQEBAQEBAR///wAAAAAAAAAAAAAAAAAAAAAAAAAAquoCAgICAgICAgICAhAQEBAQEBAQEf//AAAAAAAAAAAAAAAAAAAAAAAAAAAKqwA==","scale":1}
field1:{"type":"field","size":[237,25],"pos":[259,302],"show":"invert","style":"plain","align":"center","value":"import the \"PublicTransit\" module from this deck in order to use these transitions in your own projects!"}

{script:Listing.0}

on scaledback c do
 preview.paste[c.image 0,0,preview.size]
 preview.copy[]
end

on example do
 t:transition[][options.rowvalue.value]
 sa:scaledback[Listing]
 sb:scaledback[Darkmode]
 preview.paste[sa 0,0,sa.size]
 each i in range 30
  preview.clear[]
  t[preview sa sb i/30]
  sleep[]
 end
 preview.paste[sb 0,0,sb.size]
end

on view do
 options.value:table keys PublicTransit.descs
 descript.text:PublicTransit.descs[options.rowvalue.value]
end
{end}

{script:Listing.1}
on click row do
 view[]
 example[]
end
{end}

{script:Listing.2}
on click do
 example[]
end
{end}

{script:Listing.3}
on click do
 t:options.rowvalue.value
 go[Darkmode t]
 sleep[30]
 go["Back" t]
end
{end}

{card:Darkmode}
image:"%%[encoded data, 29196 characters]"

{module:PublicTransit}
description:"Fancy transition animations"
version:1
{data}
dissolveLut:"%%IMG1ACAAIE89euIjSGos8HDHDdaH0cTJI1FA4vxarzRTKlUc0N/Az4L8n7UcRCOz68jQ5bwirLO5ymT7VnFa7t3owcHH1cqgoe6SHc4uD3FLVSFBA+RGwQf9ROaTpLZZwFhZhDyTLlt7vyk4AoXn62MWR2jQbwRzFIHNHxlBRAj11jfi9pE29hm9KMYyqAVzUvNLBQ6QWv6nsobtztFugL4AHnxgrdCst32fmiwEDEq95NMtX/gg5w/0S+kSnztUJJhDOverTrq4h+R8G727VJH1Y4SqxSJXntWPre+I+Tay8eCdZULeLyeNZ4oB+6qMGD5u9YKucjH/zh4/zjE3t07rtnf82TF4/qMq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uMDI0Njg6PD4+PDo4NjQyMC4sKigmJCIgHhwaGBYUEhAODAoIBgQCAA="
blindsHorizLut:"%%IMG1AAEAMAAKFSAqNUBKVWBqdYCKlaCqtcDK1eDq9fbr4NbLwLaroJaLgHZrYFZLQDYrIBYLAA=="
{script}
dissolveLut:image[data.dissolveLut]
blindsVertLut:image[data.blindsVertLut]
blindsHorizLut:image[data.blindsHorizLut]

on lookup c a b t lut do
 c.merge[lut]
 c.merge[((floor 255*t) take b),(256 take a)]
end

on oval pos size do
 flip pos+size*flip unit 2*pi*(range 20)/20
end

on star c t rot do
 o:c.size/2
 r:(2.5*t)*o
 i:unit(pi/2)+(pi*rot/2)+(range 10)*(pi/5)
 p:each v index in i
  o+(if 2%index 1 else 0.5 end*r)*v
 end
 c.poly[p]
end

on heart c t do
 o:(0.5,0.6)*c.size
 r:t*c.size
 p:each v in (1,0,-1,0)join(0,-1,0,1) o+r*v end
 c.poly[p]
 c.poly[oval[o+r*( 1,-1)/2 r/sqrt 2]]
 c.poly[oval[o+r*(-1,-1)/2 r/sqrt 2]]
end

clickpos:0,0
on circleClick c t do c.poly[oval[clickpos t*max c.size]] end
on circle      c t do c.poly[oval[c.size/2 t*max c.size]] end

transition[on Dissolve       c a b t do lookup[c a b t dissolveLut   ] end]
transition[on BlindsVert     c a b t do lookup[c a b t blindsVertLut ] end]
transition[on BlindsHoriz    c a b t do lookup[c a b t blindsHorizLut] end]
transition[on StarIn         c a b t do star  [c   t 0] c.merge[a b] end]
transition[on StarOut        c a b t do star  [c 1-t 0] c.merge[b a] end]
transition[on StarSpinIn     c a b t do star  [c   t t] c.merge[a b] end]
transition[on StarSpinOut    c a b t do star  [c 1-t t] c.merge[b a] end]
transition[on HeartIn        c a b t do heart [c   t  ] c.merge[a b] end]
transition[on HeartOut       c a b t do heart [c 1-t  ] c.merge[b a] end]
transition[on CircleIn       c a b t do circle[c   t  ] c.merge[a b] end]
transition[on CircleOut      c a b t do circle[c 1-t  ] c.merge[b a] end]
transition[on CircleInClick  c a b t do if 0~t clickpos:pointer.start end circleClick[c   t] c.merge[a b] end]
transition[on CircleOutClick c a b t do if 0~t clickpos:pointer.start end circleClick[c 1-t] c.merge[b a] end]
transition[on StretchDown    c a b t do c.paste[a] c.paste[b (       0    ,  0),      b.size*1,t] end]
transition[on StretchUp      c a b t do c.paste[a] c.paste[b (c.size*0    ,1-t),(0,1)+b.size*1,t] end]
transition[on StretchRight   c a b t do c.paste[a] c.paste[b (       0    ,  0),      b.size*t,1] end]
transition[on StretchLeft    c a b t do c.paste[a] c.paste[b (c.size*(1-t),  0),(1,0)+b.size*t,1] end]

transition[on Wink c a b t do
 s:if t<.5 c.paste[a] t else c.paste[b] 1-t end
 c.rect[       0,0 c.size*1, s]
 c.rect[c.size*0,1 c.size*1,-s]
end]

module.descs.Dissolve      :"A randomized dissolve."
module.descs.BlindsVert    :"Vertical Venetian blinds."
module.descs.BlindsHoriz   :"Horizontal Venetian blinds."
module.descs.StarIn        :"Star-shaped zoom-in."
module.descs.StarOut       :"Star-shaped zoom-out."
module.descs.StarSpinIn    :"Spinning star-shaped zoom-in."
module.descs.StarSpinOut   :"Spinning star-shaped zoom-out."
module.descs.HeartIn       :"Heart-shaped zoom-in."
module.descs.HeartOut      :"Heart-shaped zoom-out."
module.descs.CircleIn      :"Circle-shaped zoom-in."
module.descs.CircleOut     :"Circle-shaped zoom-out."
module.descs.CircleInClick :"Circle-shaped zoom-in centered on the user's last click."
module.descs.CircleOutClick:"Circle-shaped zoom-out centered on the user's last click."
module.descs.StretchDown   :"Stretch the destination in from the top edge."
module.descs.StretchUp     :"Stretch the destination in from the bottom edge."
module.descs.StretchRight  :"Stretch the destination in from the left edge."
module.descs.StretchLeft   :"Stretch the destination in from the right edge."
module.descs.Wink          :"Vertical squint to black, then unsquint to destination."
{end}

