Add wings and movement of tree
This commit is contained in:
parent
1de7e1e3ac
commit
fd34e4c9c0
3 changed files with 387 additions and 10 deletions
173
magic_veneer_processing/data/leftwing.svg
Normal file
173
magic_veneer_processing/data/leftwing.svg
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="140mm"
|
||||
height="210mm"
|
||||
viewBox="0 0 140 210"
|
||||
version="1.1"
|
||||
id="svg8"
|
||||
inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"
|
||||
sodipodi:docname="leftwing.svg">
|
||||
<defs
|
||||
id="defs2" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="0.9899495"
|
||||
inkscape:cx="327.56796"
|
||||
inkscape:cy="381.06641"
|
||||
inkscape:document-units="mm"
|
||||
inkscape:current-layer="g1048"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1139"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="31"
|
||||
inkscape:window-maximized="1" />
|
||||
<metadata
|
||||
id="metadata5">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-87)">
|
||||
<g
|
||||
id="g1048"
|
||||
transform="matrix(0.99928225,0,0,0.9973688,-33.107011,47.163965)">
|
||||
<g
|
||||
id="g841">
|
||||
<path
|
||||
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 171.97916,141.27381 c 0,0 -0.21883,-29.00472 -18.07613,-54.852644 C 141.84055,68.961067 116.79757,53.557917 97.13988,47.157738 48.380952,31.28274 29.104167,46.02381 34.017858,54.339287 c 23.366394,31.129745 12.918351,36.823675 23.812499,66.901783 7.391783,17.74028 20.032738,29.86012 29.482144,32.12797 7.577013,1.81849 24.190469,1.88988 24.190469,1.88988 0,0 -31.749995,4.15774 -33.261898,28.34822 -1.511906,24.19048 -18.520836,60.4762 4.535712,66.52381 12.000726,3.14773 35.226046,-22.41985 55.465206,-36.4263 18.64559,-12.90363 30.02684,-8.20895 34.8711,-14.22251 z"
|
||||
id="path830"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cssccscssscc" />
|
||||
</g>
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path860"
|
||||
d="m 163.56895,130.49108 c 0,0 -4.27631,-52.919362 -51.04848,-70.559151 -46.772166,-17.639789 61.20472,105.036921 51.31575,71.628231"
|
||||
style="fill:#ff0000;fill-opacity:1;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path860-6"
|
||||
d="m 86.818883,95.887308 c 0,0 12.883339,31.266412 47.457277,36.222092 34.57393,4.95568 -60.772257,-55.704186 -47.838331,-36.831946"
|
||||
style="fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:0.17225674px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||
<path
|
||||
sodipodi:nodetypes="cssc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path892"
|
||||
d="m 164.04856,146.10309 c 2.21944,-2.53395 -83.372498,-24.71697 -95.163275,-21.67193 -5.797363,1.49721 8.405196,17.53418 18.013701,21.15999 16.773444,6.32955 60.773494,10.92128 77.149574,0.51194 z"
|
||||
style="fill:#00c800;fill-opacity:1;stroke:#000000;stroke-width:0.24669409px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||
<ellipse
|
||||
inkscape:transform-center-y="-28.544916"
|
||||
inkscape:transform-center-x="21.20484"
|
||||
transform="matrix(0.68179534,-0.73154297,0.80794642,0.58925596,0,0)"
|
||||
ry="12.326307"
|
||||
rx="6.8816299"
|
||||
cy="133.1192"
|
||||
cx="-43.501762"
|
||||
id="path894"
|
||||
style="fill:#ff0000;fill-opacity:1;stroke:#ff0000;stroke-width:0.34536633;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<ellipse
|
||||
inkscape:transform-center-y="-0.4425499"
|
||||
inkscape:transform-center-x="-0.34359954"
|
||||
transform="matrix(0.97470715,-0.22348597,0.4960197,0.86831127,0,0)"
|
||||
ry="18.035076"
|
||||
rx="8.2416792"
|
||||
cy="94.202576"
|
||||
cx="44.690041"
|
||||
id="path894-5"
|
||||
style="fill:#00c800;fill-opacity:1;stroke:none;stroke-width:0.45717722;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<ellipse
|
||||
inkscape:transform-center-y="-0.27562898"
|
||||
inkscape:transform-center-x="-0.30892218"
|
||||
transform="matrix(0.98677641,-0.16208735,0.65138134,0.75875052,0,0)"
|
||||
ry="12.647108"
|
||||
rx="7.381165"
|
||||
cy="111.06294"
|
||||
cx="-5.0864606"
|
||||
id="path894-5-3"
|
||||
style="fill:#ff0000;fill-opacity:1;stroke:#ff0000;stroke-width:0.36230627;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path860-6-5"
|
||||
d="m 163.62966,155.038 c 0,0 -44.62561,-2.05087 -71.202309,19.87129 -26.576695,21.92214 102.178399,-22.2092 72.150519,-19.92002"
|
||||
style="fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:0.1735758px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path860-6-5-6"
|
||||
d="m 164.34092,164.47777 c 0,0 -36.18834,7.58541 -52.31183,28.01812 -16.123482,20.43268 76.54906,-35.87008 53.0591,-28.24277"
|
||||
style="fill:#00c800;fill-opacity:1;stroke:none;stroke-width:0.13417378px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||
<path
|
||||
inkscape:transform-center-y="-9.1679422"
|
||||
inkscape:transform-center-x="13.24143"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path860-6-5-6-2"
|
||||
d="m 165.05489,175.213 c 0,0 -27.60149,10.72053 -39.58228,32.58617 -11.9808,21.8656 58.01695,-42.54378 40.15097,-32.87571"
|
||||
style="fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:0.11772445px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||
<ellipse
|
||||
inkscape:transform-center-y="-0.14033975"
|
||||
inkscape:transform-center-x="0.24293542"
|
||||
transform="matrix(-0.3627248,-0.9318963,0.66527567,-0.7465978,0,0)"
|
||||
ry="9.5917206"
|
||||
rx="4.6983724"
|
||||
cy="91.31424"
|
||||
cx="-280.33896"
|
||||
id="path894-5-9"
|
||||
style="fill:#00c800;fill-opacity:1;stroke:none;stroke-width:0.25173274;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<ellipse
|
||||
inkscape:transform-center-y="38.800906"
|
||||
inkscape:transform-center-x="24.03285"
|
||||
transform="matrix(0.61360227,0.78961526,0.7526848,-0.65838104,0,0)"
|
||||
ry="14.99591"
|
||||
rx="8.6662006"
|
||||
cy="-71.087791"
|
||||
cx="233.80789"
|
||||
id="path894-1"
|
||||
style="fill:#ff0000;fill-opacity:1;stroke:#ff0000;stroke-width:0.42748275;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<ellipse
|
||||
inkscape:transform-center-y="10.809001"
|
||||
inkscape:transform-center-x="0.23561706"
|
||||
transform="matrix(-0.31568306,-0.94886469,0.70176836,-0.7124052,0,0)"
|
||||
ry="9.5917196"
|
||||
rx="4.6983724"
|
||||
cy="44.879757"
|
||||
cx="-258.25589"
|
||||
id="path894-5-9-2"
|
||||
style="fill:#00c800;fill-opacity:1;stroke:none;stroke-width:0.25173274;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<ellipse
|
||||
inkscape:transform-center-y="13.794713"
|
||||
inkscape:transform-center-x="-0.83178735"
|
||||
transform="matrix(-0.49832835,-0.86698838,0.74950393,-0.66199989,0,0)"
|
||||
ry="14.759423"
|
||||
rx="6.2716498"
|
||||
cy="-19.121754"
|
||||
cx="-216.33589"
|
||||
id="path894-5-9-2-7"
|
||||
style="fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:0.36078072;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 8.2 KiB |
170
magic_veneer_processing/data/rightwing.svg
Normal file
170
magic_veneer_processing/data/rightwing.svg
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="140mm"
|
||||
height="210mm"
|
||||
viewBox="0 0 140 210"
|
||||
version="1.1"
|
||||
id="svg8"
|
||||
inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"
|
||||
sodipodi:docname="rightwing.svg">
|
||||
<defs
|
||||
id="defs2" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="0.49497475"
|
||||
inkscape:cx="485.93916"
|
||||
inkscape:cy="406.59149"
|
||||
inkscape:document-units="mm"
|
||||
inkscape:current-layer="g1048"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1139"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="31"
|
||||
inkscape:window-maximized="1" />
|
||||
<metadata
|
||||
id="metadata5">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-87)">
|
||||
<g
|
||||
id="g1048"
|
||||
transform="matrix(-0.99928225,0,0,0.9973688,173.13663,47.163965)">
|
||||
<path
|
||||
sodipodi:nodetypes="cssccscssscc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path830"
|
||||
d="m 171.97916,141.27381 c 0,0 -0.21883,-29.00472 -18.07613,-54.852644 C 141.84055,68.961067 116.79757,53.557917 97.13988,47.157738 48.380952,31.28274 29.104167,46.02381 34.017858,54.339287 c 23.366394,31.129745 12.918351,36.823675 23.812499,66.901783 7.391783,17.74028 20.032738,29.86012 29.482144,32.12797 7.577013,1.81849 24.190469,1.88988 24.190469,1.88988 0,0 -31.749995,4.15774 -33.261898,28.34822 -1.511906,24.19048 -18.520836,60.4762 4.535712,66.52381 12.000726,3.14773 35.226046,-22.41985 55.465206,-36.4263 18.64559,-12.90363 30.02684,-8.20895 34.8711,-14.22251 z"
|
||||
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path860"
|
||||
d="m 163.56895,130.49108 c 0,0 -4.27631,-52.919362 -51.04848,-70.559151 -46.772166,-17.639789 61.20472,105.036921 51.31575,71.628231"
|
||||
style="fill:#ff0000;fill-opacity:1;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path860-6"
|
||||
d="m 86.818883,95.887308 c 0,0 12.883339,31.266412 47.457277,36.222092 34.57393,4.95568 -60.772257,-55.704186 -47.838331,-36.831946"
|
||||
style="fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:0.17225674px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||
<path
|
||||
sodipodi:nodetypes="cssc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path892"
|
||||
d="m 164.04856,146.10309 c 2.21944,-2.53395 -83.372498,-24.71697 -95.163275,-21.67193 -5.797363,1.49721 8.405196,17.53418 18.013701,21.15999 16.773444,6.32955 60.773494,10.92128 77.149574,0.51194 z"
|
||||
style="fill:#00c800;fill-opacity:1;stroke:#000000;stroke-width:0.24669409px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||
<ellipse
|
||||
inkscape:transform-center-y="-28.544916"
|
||||
inkscape:transform-center-x="21.20484"
|
||||
transform="matrix(0.68179534,-0.73154297,0.80794642,0.58925596,0,0)"
|
||||
ry="12.326307"
|
||||
rx="6.8816299"
|
||||
cy="133.1192"
|
||||
cx="-43.501762"
|
||||
id="path894"
|
||||
style="fill:#ff0000;fill-opacity:1;stroke:#ff0000;stroke-width:0.34536633;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<ellipse
|
||||
inkscape:transform-center-y="-0.4425499"
|
||||
inkscape:transform-center-x="-0.34359954"
|
||||
transform="matrix(0.97470715,-0.22348597,0.4960197,0.86831127,0,0)"
|
||||
ry="18.035076"
|
||||
rx="8.2416792"
|
||||
cy="94.202576"
|
||||
cx="44.690041"
|
||||
id="path894-5"
|
||||
style="fill:#00c800;fill-opacity:1;stroke:none;stroke-width:0.45717722;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<ellipse
|
||||
inkscape:transform-center-y="-0.27562898"
|
||||
inkscape:transform-center-x="-0.30892218"
|
||||
transform="matrix(0.98677641,-0.16208735,0.65138134,0.75875052,0,0)"
|
||||
ry="12.647108"
|
||||
rx="7.381165"
|
||||
cy="111.06294"
|
||||
cx="-5.0864606"
|
||||
id="path894-5-3"
|
||||
style="fill:#ff0000;fill-opacity:1;stroke:#ff0000;stroke-width:0.36230627;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path860-6-5"
|
||||
d="m 163.62966,155.038 c 0,0 -44.62561,-2.05087 -71.202309,19.87129 -26.576695,21.92214 102.178399,-22.2092 72.150519,-19.92002"
|
||||
style="fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:0.1735758px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path860-6-5-6"
|
||||
d="m 164.34092,164.47777 c 0,0 -36.18834,7.58541 -52.31183,28.01812 -16.123482,20.43268 76.54906,-35.87008 53.0591,-28.24277"
|
||||
style="fill:#00c800;fill-opacity:1;stroke:none;stroke-width:0.13417378px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||
<path
|
||||
inkscape:transform-center-y="-9.1679422"
|
||||
inkscape:transform-center-x="13.24143"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path860-6-5-6-2"
|
||||
d="m 165.05489,175.213 c 0,0 -27.60149,10.72053 -39.58228,32.58617 -11.9808,21.8656 58.01695,-42.54378 40.15097,-32.87571"
|
||||
style="fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:0.11772445px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||
<ellipse
|
||||
inkscape:transform-center-y="-0.14033975"
|
||||
inkscape:transform-center-x="0.24293542"
|
||||
transform="matrix(-0.3627248,-0.9318963,0.66527567,-0.7465978,0,0)"
|
||||
ry="9.5917206"
|
||||
rx="4.6983724"
|
||||
cy="91.31424"
|
||||
cx="-280.33896"
|
||||
id="path894-5-9"
|
||||
style="fill:#00c800;fill-opacity:1;stroke:none;stroke-width:0.25173274;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<ellipse
|
||||
inkscape:transform-center-y="38.800906"
|
||||
inkscape:transform-center-x="24.03285"
|
||||
transform="matrix(0.61360227,0.78961526,0.7526848,-0.65838104,0,0)"
|
||||
ry="14.99591"
|
||||
rx="8.6662006"
|
||||
cy="-71.087791"
|
||||
cx="233.80789"
|
||||
id="path894-1"
|
||||
style="fill:#ff0000;fill-opacity:1;stroke:#ff0000;stroke-width:0.42748275;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<ellipse
|
||||
inkscape:transform-center-y="10.809001"
|
||||
inkscape:transform-center-x="0.23561706"
|
||||
transform="matrix(-0.31568306,-0.94886469,0.70176836,-0.7124052,0,0)"
|
||||
ry="9.5917196"
|
||||
rx="4.6983724"
|
||||
cy="44.879757"
|
||||
cx="-258.25589"
|
||||
id="path894-5-9-2"
|
||||
style="fill:#00c800;fill-opacity:1;stroke:none;stroke-width:0.25173274;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<ellipse
|
||||
inkscape:transform-center-y="13.794713"
|
||||
inkscape:transform-center-x="-0.83178735"
|
||||
transform="matrix(-0.49832835,-0.86698838,0.74950393,-0.66199989,0,0)"
|
||||
ry="14.759423"
|
||||
rx="6.2716498"
|
||||
cy="-19.121754"
|
||||
cx="-216.33589"
|
||||
id="path894-5-9-2-7"
|
||||
style="fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:0.36078072;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 8.1 KiB |
|
|
@ -5,18 +5,29 @@ String receivedMessage;
|
|||
boolean cameIntoThreshhold = false;
|
||||
|
||||
PShape branch;
|
||||
PShape leftWing;
|
||||
PShape rightWing;
|
||||
float velocity = 6;
|
||||
float backgroundOffset = 0;
|
||||
float placementIndicatorOffsetX = 0;
|
||||
int placementIndicatorAnimationCounter = 0;
|
||||
String placementIndicatorAnimationDirection = "right";
|
||||
float cocoonOpenDegrees = 0;
|
||||
String cocoonAnimationDirection = "close";
|
||||
boolean cocoonAnimationFinished = false;
|
||||
float wingOpacity = 0;
|
||||
float treeOffset = 0;
|
||||
|
||||
void setup() {
|
||||
/* Set up screen */
|
||||
fullScreen();
|
||||
background(0);
|
||||
|
||||
|
||||
/* Load external files */
|
||||
branch = loadShape("branch.svg");
|
||||
leftWing = loadShape("leftwing.svg");
|
||||
rightWing = loadShape("rightwing.svg");
|
||||
|
||||
/* Set up communication with arduino
|
||||
String portName = Serial.list()[Serial.list().length - 1]; //change index to match your port
|
||||
|
|
@ -26,7 +37,8 @@ void setup() {
|
|||
void draw() {
|
||||
background(255);
|
||||
translate(0, backgroundOffset);
|
||||
backgroundOffset+= 4;
|
||||
backgroundOffset = backgroundOffset + velocity;
|
||||
println(backgroundOffset);
|
||||
|
||||
/* if ( arduinoPort.available() > 0) {
|
||||
String rec = arduinoPort.readStringUntil('\n');
|
||||
|
|
@ -69,23 +81,45 @@ void draw() {
|
|||
bug(width - 400, -300, 1);
|
||||
/* END - Scene 1 Bugs going by */
|
||||
|
||||
|
||||
if (backgroundOffset < 2450) {
|
||||
/* START - Scene 2 Crawling on branch */
|
||||
println("Under threshhold");
|
||||
shape(branch, 0, -3200, width, width);
|
||||
/* END - Scene 2 Crawling on branch */
|
||||
}
|
||||
if (backgroundOffset > 2450 && backgroundOffset < 5000) {
|
||||
/* START - Scene 3 Cocooning */
|
||||
// 1. Place tree at initial position minus delta (Offset at entering threshhold to current threshhold)
|
||||
shape(branch, 0, -3200 - (backgroundOffset - 2450), width, width);
|
||||
// 2. Start cocoon animation
|
||||
if (backgroundOffset > 2450 && backgroundOffset < 4400) {
|
||||
if (cocoonAnimationFinished == false) {
|
||||
if (cocoonAnimationDirection == "close" && cocoonOpenDegrees < 165) {
|
||||
cocoonOpenDegrees++;
|
||||
} else if (cocoonAnimationDirection == "close" && cocoonOpenDegrees >= 165) {
|
||||
cocoonOpenDegrees = 165;
|
||||
cocoonAnimationDirection = "open";
|
||||
} if (cocoonAnimationDirection == "open" && cocoonOpenDegrees > 0) {
|
||||
cocoonOpenDegrees--;
|
||||
} if (cocoonAnimationDirection == "open" && cocoonOpenDegrees <= 0) {
|
||||
cocoonOpenDegrees = 0;
|
||||
cocoonAnimationFinished = true;
|
||||
}
|
||||
|
||||
// 3. Keep cocoon for x amount of time
|
||||
fill(0);
|
||||
noStroke();
|
||||
arc(width / 2, -1900 - (backgroundOffset - 2450), 300, 700, radians(260 - cocoonOpenDegrees), radians(280 + cocoonOpenDegrees), PIE);
|
||||
|
||||
print("Tree position: ");
|
||||
shape(branch, 0, -3200 - (backgroundOffset - 2450), width, width);
|
||||
}
|
||||
|
||||
// 3. Let tree move again
|
||||
/* END - Scene 3 Cocooning */
|
||||
} else if (backgroundOffset > 5000) {
|
||||
} else if (backgroundOffset > 4400) {
|
||||
shape(branch, 0, -3200 - (backgroundOffset - 2450) + treeOffset, width, width);
|
||||
treeOffset = treeOffset + velocity;
|
||||
/* START - Scene 4 Butterfly */
|
||||
println("Over threshhold");
|
||||
shape(leftWing, width / 2 - 540, (height / 2 - 500 * 0.8) - backgroundOffset, 500, 500 * 1.5);
|
||||
shape(rightWing, width / 2 + 40, (height / 2 - 500 * 0.8) - backgroundOffset, 500, 500 * 1.5);
|
||||
|
||||
// 4. Fly and move tree downwards again
|
||||
|
||||
/* END - Scene 4 Butterfly */
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue